Route parameters
When you develop React web applications, some of your routes have dynamic data in them. For example, you can link to a details page, and within that URL, you'll have some sort of identifier. The component then has what it needs to render specific detailed information. The same concept exists within react-navigation
. Instead of just specifying the name of the screen that you want to navigate to, you can pass along additional data.
Let's take a look at route parameters in action:
- We'll start with the
App
component:import { NavigationContainer } from "@react-navigation/native"; import { createNativeStackNavigator } from "@react-navigation/native-stack"; import Home from "./Home"; import Details from "./Details"; const Stack = createNativeStackNavigator(); export default function App() { return ( <NavigationContainer> <Stack...