Adding the <NativeRouter> component

Let's now add the react-router-native package to the application that we just created:

    npm install --save react-router-native

The NativeRouter component is used in React Native applications to provide routing and navigation support. It enables components such as <Route> and <Link> to be used in the native application. 

Let's first create a side menu that includes a couple of <Link> components: 

import { Link } from 'react-router-native';export class Menu extends Component {    render() {        return (            <ScrollView scrollsToTop={false} style={styles.menu}>                <View>                    <Link to="/">                        <Text>Home</Text>                    </Link>                    <Link to="/dashboard">                        <Text>Dashboard</Text>                    </Link>                </View>            </ScrollView>        )    }}

The <ScrollView> component is ...

Get React Router Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.