Closed JayChetty closed 5 years ago
Hey! glad you like it.
Injecting the API wrapper with getExtraArgs
does a few things:
AUTH_EXPIRED
action whenever the API returns a 401
response. Rather than handle that logic in every action creator that calls the API you can make your API wrapper handle it. (of course you could pass the store into your helper too, but this way it's just done).The reactors thing is a separate question. Essentially the "having something separate that subscribes to store and triggers actions" is essentially how reactors work. That said, there's nothing stopping you from building your own using store.subscribeToSelectors
. But the built in approach also helps a bit by only allowing one at a time, and uses requestIdleCallback
to attempt to schedule the action for a time when the main thread is busy, causing jank, etc.
Hope that helps.
Helps a lot. Thanks!
Love the approach taken by this library. Was wondering what the advantages are of injecting the API wrapper using getExtraArgs and using reactors, compared to having something completely separate that just subscribes to the store and triggers actions?