2 ms·
You can do this pretty simply with hooks and reducers, where the reducer/dispatch are the model/controller. Class components have their own pitfalls when you s
by bobthepanda 6mo ago
You can do this pretty simply with hooks and reducers, where the reducer/dispatch are the model/controller.
Class components have their own pitfalls when you start messing around with componentDidUpdate, which was part of the motivation behind functional components IIRC.
- lateforwork 6mo agoNot everyone likes hooks. Class components may have issues, but if hooks are the solution I'll stay with class components, thank you very much!
- bobthepanda 6mo agoI will say that I used to really not like hooks and that’s because I think the migration documentation and messaging was handled pretty poorly. That being said, if you’ve worked with state management like Redux, I would argue that hooks are pretty similar to how you hook up that kind of data store.
- lateforwork 6mo agoYeah, Redux is another big mistake I stayed away from. "Line after line of throat clearing and pseduostructure", as one developer put it [1] [1] https://news.ycombinator.com/item?id=15342764 https://news.ycombinator.com/item?id=15342764