4 ms·
> why does liking a tweet re-render the entire screen? They're probably using Redux, which has been the go-to for state management in React for nearly a decade
by Izkata 2y ago
> why does liking a tweet re-render the entire screen?
They're probably using Redux, which has been the go-to for state management in React for nearly a decade. I've always been averse to it because it's implemented using contexts and triggers those full re-renders - it was designed during the class-based components era and relied on people actually implementing shouldComponentUpdate(), which isn't really a thing with modern function-based components.
If they were using modern hook-based state management like Zustand or Valtio, full rerenders wouldn't happen.
- efdee 2y agoRedux uses context but does not do full re-renders except if you are using it wrong. It does a shallow compare on the object resulting from your selector to decide whether or not to re-render a component. That being said, none of the React projects I've had the chance of working on in the last 5 or 6 years has used Redux, so stating that it's been the go-to state management library for nearly a decade kind of sounds weird to me.