Roa
Roa

Reputation: 437

React navigation v5 getting initialParams prop on Screen

I have tried many times to get initialParams with this.props.navigation.state.params. It wasn't helpful. Help me please how to get these params.

<Stack.Screen name="FromMainScreenToSubCats" component={FromMainScreenToSubCats} initialParams={{catId:1 , title:'Filmler'}} />

Upvotes: 1

Views: 7841

Answers (1)

satya164
satya164

Reputation: 10143

You can access params with this.props.route.params

https://reactnavigation.org/docs/en/upgrading-from-4.x.html#separate-route-prop

Upvotes: 8

Related Questions