I have two components I want to pass some property data from on page to other page/component. But unable to do that with props.
<TouchableOpacity onPress={() => {this.navigateTo('component2'); setState(url: 'www.xyz.com', data: 'abc' }>
<View style={{ flexDirection: 'row', height: 60, justifyContent: 'center', alignItems: 'center', paddingLeft: 10 }}>
<Image source={deals} />
<View style={{ flex: 1 }}>
<Text style={{ color: '#000' }}> Deal Center </Text>
</View>
</View>
</TouchableOpacity>
and want to read the state from component2. Can anyone please help
you can write a function which navigator to 1 Component and passProps.
Example :
And place this function in your code like :
In your 2nd component, you can call props like :
this.props.url
orthis.props.data
Here is a good tutorial for React Native Navigator, take a look