September 2018
Beginner
156 pages
3h 28m
English
The initialEntries prop is used to populate the history stack with a list of locations:
export default class App extends Component { render() { const initialEntries = ['/', '/dashboard']; return ( <NativeRouter initialEntries={initialEntries}> ... </NativeRouter> ); }}
At the time of initializing NativeRouter, you could populate the history by providing an array of location paths. A location path could be a string or even an object of shape { pathname, search, hash, state }:
const initialEntries = [ '/' , { pathname: '/dashboard', search: '', hash: 'test', state: { from: '/'} }];
Read now
Unlock full access