<Link>
(React Native)<Link>
. For the web version, go here.
declare function Link(props: LinkProps): React.ReactElement; interface LinkProps extends TouchableHighlightProps { children?: React.ReactNode; onPress?(event: GestureResponderEvent): void; replace?: boolean; state?: any; to: To; }
A <Link>
is an element that lets the user navigate to another view by tapping it, similar to how <a>
elements work in a web app. In react-router-native
, a <Link>
renders a TouchableHighlight
. To override default styling and behaviour, please refer to the Props reference for TouchableHighlight
.
import * as React from "react"; import { View, Text } from "react-native"; import { Link } from "react-router-native"; function Home() { return ( <View> <Text>Welcome!</Text> <Link to="/profile"> <Text>Visit your profile</Text> </Link> </View> ); }
© React Training 2015-2019
© Remix Software 2020-2022
Licensed under the MIT License (MIT).
https://reactrouterdotcom.fly.dev/docs/en/v6/components/link-native