I am using React Navigation to route between screen. I have an initial screen which contains a FlatList
, onclick of an item I route to a new screen while passing params like this.
props.navigation.navigate('Details', {
id: props.id,
title: props.title
});
In the Details
screen I can receive it using the following code but how do I set the state considering it's a static function and I do not have access to this.setState()
.
static navigationOptions = ({navigation}) => {
const {params} = navigation.state;
console.log(params);
};