3 ms·
Lots of reasons: - Isolation of "write logic" means you know where to look to see what code is updating a given chunk of state - Consistent state handling mea
by acemarke 10y ago
Lots of reasons:
- Isolation of "write logic" means you know where to look to see what code is updating a given chunk of state
- Consistent state handling means it's a lot easier to think about what's going on in the application
- The DevTools show you a log of dispatched actions, and enable you to step back and forth between states to see what the UI looked like at each point
- Middleware lets you centralize app-wide logic, such as consistent transformations for AJAX responses
- Redux's constraints (such as wanting state to be serializable) enable a number of other use cases, such as persisting state across page reloads and synchronizing multiple stores remotely.
- There's a rapidly growing ecosystem of addons and utilities for specific use cases (see https://github.com/markerikson/redux-ecosystem-links https://github.com/markerikson/redux-ecosystem-links )
- forgottenacc57 10y agoI've built a pretty large react app and never needed these things. Things like stepping back through state seem honestly to me to be a gimmick not worth the required investment of time and pain.
- acemarke 10y agoI've seen a number of people make comments to that effect, and I genuinely don't understand that point of view. I use time-travel debugging on a daily basis, and it's a _huge_ time-saver for me. I also don't understand the "required investment of time and pain" comment. I've got a couple lines in my store configuration that sets up the Redux DevTools extension, and after that, It Just Works (TM). In fact, one of the posts in my "Practical Redux" tutorial series shows how to configure it: http://blog.isquaredsoftware.com/2016/11/practical-redux-part-3-project-planning-and-setup/ http://blog.isquaredsoftware.com/2016/11/practical-redux-par... .