Answer the question
In order to leave comments, you need to log in
Why might you need a subsribe from the store?
when using connect from react-redux, the component is decorated and subscribes to the change of the store, which then may require the execution of some function after updating the store, if we already track this in the components. and connect also uses store.subsrcibe or something else to add the component subscription to the store?
Answer the question
In order to leave comments, you need to log in
To begin with, redux is a standalone solution that can be used separately from the react stack. By this - the API is developed for general needs. In the case of connect, yes, subscribe is used there.
If you are developing on rxjs, you can make an observable from your store (although now there is a more convenient way for this). It is also very useful to subscribe if you are developing infrastructure modules. An idea came to mind - you have localStoe - you need to synchronize some piece of state in order to understand that state has changed - subscribe to store.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question