react native use route params

Solutions on MaxInterview for react native use route params by the best coders in the world

showing results for - "react native use route params"
Baptiste
19 Sep 2020
1import * as React from 'react';
2import { Text } from 'react-native';
3import { useRoute } from '@react-navigation/native';
4
5function MyText() {
6  const route = useRoute();
7
8  return <Text>{route.params.caption}</Text>;
9}
Isaac
13 Mar 2019
1navigation.navigate('RouteName', { /* params go here */ })
2
3to recieve the params
4
5function DetailsScreen({ route, navigation }) {
6  const { itemId, otherParam } = route.params;
7  return(<Text>itemId<Text>);
8}