2

For class component there is "this.props.route.params" option. How to get params from one screen to other screen in react hook functional component.

"react": "16.11.0",
"react-native": "0.62.2",
"react-navigation": "@react-navigation/native": "^5.1.2",
  • Does this answer your question? [Programmatically navigate using react router](https://stackoverflow.com/questions/31079081/programmatically-navigate-using-react-router) – Pavlonator Jun 01 '20 at 21:47

3 Answers3

2

You can use the hook useRouter from @react-navigation/native

import * as React from 'react';
import { Text } from 'react-native';
import { useRoute } from '@react-navigation/native';

function MyText() {
  const route = useRoute();

  return <Text>{route.params.caption}</Text>;
}
Jackmekiss
  • 456
  • 3
  • 10
0

You can use:

props.navigation.getParam('param_name')
B. Mohammad
  • 1,699
  • 8
  • 26
0

this.props.navigation.getParam('param_name')