3 ms·
I think folks were too quick to throw out the good things about redux when hooks came out. Namely “dumb” presentational components that had no logic and abstrac
by adregan 1y ago
I think folks were too quick to throw out the good things about redux when hooks came out. Namely “dumb” presentational components that had no logic and abstractions for wiring up data and actions (mapStateToProps and mapDispatchToProps).
Sure reducers could be a bear (and asynchronous actions were hard), but the easily testable and portable logic-less views were really nice to work with.
Having worked in a number of codebases from React’s earliest days until now, I see echos of the bad old mixin days in the usage of hooks.
- acemarke 1y agoI'm the primary Redux maintainer. FWIW, `connect` still exists and we have no plans to remove it, but it's also _very_ complicated internally and we honestly don't want people using it today. If I _could_ remove it without breaking user apps I would. `useSelector` is a drastically simpler implementation, better app performance, and smaller bundle size. I do get what you mean about the conceptual separation, although something about the HOC approach also led to a lot of historical user confusion about "where _are_ my props coming from?". As for writing the rest of your Redux logic, our modern Redux Toolkit package has addressed the historical concerns about boilerplate and other pain points: - https://redux.js.org/introduction/why-rtk-is-redux-today https://redux.js.org/introduction/why-rtk-is-redux-today - https://redux.js.org/tutorials/essentials/part-2-app-structure https://redux.js.org/tutorials/essentials/part-2-app-structu...