Hacker News new | ask | show | jobs
by methyl 3026 days ago
This 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/subsc...

2 comments

Ahh 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?

Agreed. 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).