September 2018
Beginner
156 pages
3h 28m
English
The initialIndex prop is used to specify the index value of the location in the initialEntries array to render when the application loads. For example, if the initialEntries array has two locations listed, then an initialIndex value of 1 loads the second entry; that is, a <Route> instance matching the pathname mentioned as the second entry in initialEntries array is rendered:
export default class App extends Component { render() { const initialEntries = ['/', '/dashboard']; const initialIndex = 1; return ( <NativeRouter initialEntries={initialEntries} initialIndex={initialIndex}> ... </NativeRouter> ) }}
In this example, the initialIndex value is set to 1 and thus the <Route> matching the location path /dashboard ...
Read now
Unlock full access