erikras / erikras/react-redux-universal-hot-example

Access to Redux store from another module?

Open
#1,104 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

A question about structuring my code. I have a module that connects to an external server and supplies updates that want to go into the Redux store. It must run on the server, and I am (successfully) initializing and starting the module from server.js, right before the call to server.listen()

I want that module to be able to send actions to the Redux store. I think I see how to handle all the reducers, etc. My question:

What's the "right way" to make my module aware/able to access the redux store?

(I see that app.use() in server.js calls createStore(). I thought about passing store as a parameter to my module's init(), but that seems to be called with every request...)

Update: Oh, wait. It could be worse than I thought. The store is constantly being updated/replaced - how can my module continually track the current store? Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.