Manikandan K
Manikandan K

Reputation: 117

How to pass data from one view to another view in react native?

I want to pass one array from first view to second view in react native. So how can I achieve this in react native ? For navigation I am using 'react-navigation'.

this.navigation.navigateWithDebounce('BlaBlaView', {title: 'BlaBla View'}).

Upvotes: 1

Views: 2096

Answers (1)

MorKadosh
MorKadosh

Reputation: 6006

If your'e using react-navigation's naviagte. you can pass the parameters as the second parameter, for instance:

this.props.navigation.navigate(`ROUTE_NAME`, { params: 'param value' });

And then, within the view you navigated to you can access it:

componentWillMount() {
    const { param } = this.props.navigation.state.params;
}

Upvotes: 3

Related Questions