4 ms·
Isn’t one of the points of redux to decouple actions from reducers? How would you implement multiple reducers responding to a single action if your actions are
by myguysi 9y ago
Isn’t one of the points of redux to decouple actions from reducers? How would you implement multiple reducers responding to a single action if your actions are tied to a reducer with a namespace?
- methyl 9y agoThis can be done using Subscriptions [1]. I have another problem with this library, which is relying on singleton pattern for communication. This way, you cannot have more than one rematch instance in one application, which can be limiting. It also makes reasoning more difficult. [1] https://github.com/rematch/rematch/blob/master/plugins/subscriptions/README.md https://github.com/rematch/rematch/blob/master/plugins/subsc...
- dvlsg 9y agoAgreed. The singleton pattern for state is a non starter for me. Got super wary as soon as I saw `dispatch` get imported and used directly. It's easier to get started, but you'll likely have really nasty problems later (testing, server side rendering, etc).
- myguysi 9y agoAhh thanks, I was lazy and didn’t go looking for an answer. Though this line seems a bit odd.. > In this case, subscriptions avoid the need of coupling the auth model to the profile model. Profile simply listens to an action. I guess it’s no different to using “vanilla” redux actions but because actions contain the reducer namespace then it’s inherently coupled to another model isn’t it?
- deleted 9y ago[deleted]