4 ms·
The implication behind “we don’t use Redux, we use hooks” is that they’re using React’s Context API directly as a “store”. A component at the top level has some
by dceddia 6y ago
The implication behind “we don’t use Redux, we use hooks” is that they’re using React’s Context API directly as a “store”. A component at the top level has some state, probably using the useReducer hook, that state is passed down using a Context Provider, and child components can access the data with useContext.
You can DIY a Redux imitation with hooks pretty easily but making it as performant as Redux is harder.
- ricardobeat 6y agoIndeed. IIRC redux itself tried that in an earlier version but reverted to a custom update / forced render mechanism due to performance bottlenecks with Context.
- acemarke 6y agoYep. References with the details on what we tried to do in v6, and how we rewrote things in v7: - https://github.com/reduxjs/react-redux/issues/1177 https://github.com/reduxjs/react-redux/issues/1177 - https://blog.isquaredsoftware.com/2018/11/react-redux-history-implementation/ https://blog.isquaredsoftware.com/2018/11/react-redux-histor...