Preventing component re-renderings in React.js with useSelector
I gave a presentation “Preventing component re-renderings in React.js with
useSelector” at the Women Who Code Austin, Texas frontend meetup. Here are the slides.
The standard advice on React-Redux and redux-toolkit libraries says that if we use the
useSelector hook with the
shallowEqual to select a component’s state, it will prevent re-rendering the component if its state hasn’t changed. But as we find out, the reality is more nuanced. This presentation is about that. It first shows how to prevent re-renderings using React-Redux, and then redux-toolkit libraries.