Reputation: 180
Is it better to pass params from one screen to another with redux dispatch or with react-navigation ?
Redux way:
Passing params (screen 1)
dispatch({
type: PARAMS_TYPE,
payload: {param1, param2}
});
Getting params (screen 2)
const {params} = this.props;
React-navigation way:
Passing params (screen 1)
this.props.navigation.navigate("Screen2",{param1, param2});
Getting params (screen 2)
this.props.navigation.state.params.param1;
Upvotes: 4
Views: 1003
Reputation: 111
If you are using Redux in your Application than better way to do this is through Redux. This is because Redux stores complete state of an application in a single store which you can access from any component using props. React-navigation will make this task very complex and difficult to maintain if the Application is complex.
Upvotes: 3