Why use “this.props.dispatch” rather than “store.dispatch” directly in Redux?

In universal apps, you’ll want a different store instance on every request. If you just export store as a singleton from some module, you’ll have a hard time adding server rendering.

This is why we never encourage singleton store in the docs, and always encourage you to use <Provider> to pass it down the hierarchy via React context. This makes store available to the consuming components without making it a singleton.

As for why connect() from React Redux passes dispatch as a prop instead of store itself—it’s because you don’t really need store itself in the connected components. Subscription and reading state is done by connect() so you’ll only ever need dispatch() in components.

Leave a Comment