Redux integration
It is extremely easy to use Redux in an app with React Navigation. It's basically no different than without React Navigation.
Notice that we wrap our components in a Provider
like we'd normally do with react-redux
. Ta da! Now feel free to use connect
throughout your app.
connect
ed in options
Use a component that is Create a component, connect
it to the store, then use that component in the title
.
Pass the state you care about as a param to the screen
If the value isn't expected to change, you can just pass it from a connect
ed component to the other screen as a param.
Can I store the navigation state in Redux too?
This is not possible. We don't support it because it's too easy to shoot yourself in the foot and slow down / break your app.
However it's possible to use redux-devtools-extension
to inspect the navigation state and actions, as well as perform time travel debugging by using the devtools
package.