JustLogin JustLogin - 19 days ago 6
Javascript Question

Is there any way reading from store not from Component in React-redux?

I'm using React and Redux in my app as main architecture frameworks. And I want to create a simple utility script which sends requests to all IPs written in

store
adding some headers to them. I use code like this for
store
connection in
Component
:

export default connect(() => {
return {};
})(MyClass);


But how do I connect to
store
in a simple script, not in
Component
?

Answer

If you have a reference to a store, you can get the current state via

store.getState()
Comments