4 ms·
well, when you use redux to manage the router state, you get the best of both worlds. "current thread" doesn't need to be stored in the state in an explicit w
by snappy173 11y ago
well, when you use redux to manage the router state, you get the best of both worlds.
"current thread" doesn't need to be stored in the state in an explicit way. rather, you just need to be able to derive the "current thread" (or whatever) from the state.
so, your state contains the current route, and you use that to derive the "current thread" and then if redux has any state corresponding to that thread (or whatever) you can get that, too.
- matt4077 11y agoThis might just be personal preference, but it seems that "current thread" is the more pure representation of (that part) of the current state, and the URL/route should be the derived attribute.
- snappy173 11y agoIn that case, you can have a redux state reducer look for navigation actions, and set current thread. Either way works well with the flux/redux mental model. And in either case, you'll have to implement logic for mapping route -> current thread and vice versa ...