18 ms·
Why use classes instead of functions. Isn’t the React ecosystem moving away from classes entirely? I remember hearing somewhere that a core maintainer of React
by purple-again 6y ago
Why use classes instead of functions. Isn’t the React ecosystem moving away from classes entirely? I remember hearing somewhere that a core maintainer of React stated we should be using function components everywhere now.
- chrisabrams 6y agoOP didn't want to use hooks, so I showed an example that doesn't require hooks. I'm aware some of the React community use hooks, some of us still use classes. Classes provide a better interface when dealing with state that is shared between parent and child. This is a write up much better than I can explain: https://react-redux.js.org/api/hooks#stale-props-and-zombie-children https://react-redux.js.org/api/hooks#stale-props-and-zombie-...