question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modernise codebase discussion

See original GitHub issue

Looking to kickstart some discussion around modernising the code base and future features

  • Switch to ES6 classes instead of create-react-class - much easier for newcomers to React to understand the code with this, plus it’s increasingly the recommended way across the ecosystem
  • Switch to ES6 for the codebase - (this isn’t a lot actually, mostly var -> let/const, arrow functions etc)
  • Use the setState(fn) form rather than the setState(obj) form in anticipation of priorities in fiber
  • Figure out build process if using ES6 (rollup/webpack + babel)
  • Add support for requestAnimationFrame for high performance scroll listeners
  • Support passive event listeners for better perf
  • In modern browsers with Intersection Observer support, use that instead of JS calculations (eventually over time this lib should become a wrapper around that w/ polyfill for older browsers?)
  • More “functional” API (refer https://github.com/joshwnj/react-visibility-sensor/issues/74)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
meticoeuscommented, Jun 2, 2017

You can check for passive scrolling support with this snippet:

var supportsPassive = false;
try {
  var opts = Object.defineProperty({}, 'passive', {
    get() {
      supportsPassive = true;
    },
  });
  window.addEventListener('test', null, opts);
} catch (e) { /* pass */ }

First came across it in react-chatview

0reactions
helfercommented, Jul 6, 2018

Any progress here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding and Modernizing a Legacy Codebase
Understanding and Modernizing a Legacy Codebase ... we held an online discussion about the endpoint to allow everyone to ask questions about ...
Read more >
How can I update a large legacy codebase to meet specific ...
I am looking specifically for incremental improvements that have been proven to be a success in the real world when updating a large...
Read more >
5 Tips For Modernizing Legacy Code | designnews.com
First, as we have discussed, the team should understand where the code base currently stands. This should include understanding the current ...
Read more >
[discussion] Environment specific modules with updates.
In the development environment: update the code base with new versions of modules. (composer update); run update hooks; export configuration.
Read more >
3 Tips for Modernizing your iOS codebase | by Charlie Bartel
An elegant approach for migrating all your UIViewControllers to the replacement methods is discussed on Stack Overflow. - (void) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found