When I use a component function as shown below, I’m able to access data
passed through navigation.navigate("NavigateToScreen", {data: {}})
function in the following:
import { useNavigation } from '@react-navigation/native';
export default function ScreenName(props) {
const data = props.route.params.data;
const navigation = useNavigation();
}
How do I access data
in target screen when receiving screen is as follows:
export default function ScreenName({ navigation }) {
const data = //How do I receive props here
}
2
Answers
You can access them through the
route
parameter:You can access them using the
route
parameter or check out theuseRoute
hook. Follow this link for a detailed explanation