September 2018
Beginner
156 pages
3h 28m
English
The keyLength prop is used to specify the length for the location.key. The locaction.key property represents a unique key that is provided to a location. Take a look at the following code snippet:
<BrowserRouter keyLength={10}> <div className="container"> <nav> <Link to="/dashboard">Dashboard</Link> <Link to="/user">User</Link> </nav> <Route path="/dashboard" render={({ location }) => <div> In Dashboard, Location Key: {location.key} </div> } /> <Route path="/user" render={({ location }) => <div> In User, Location Key: {location.key} </div> } /> </div></BrowserRouter>
When you navigate to either of the /dashboard or /user paths, the value of location.key will be a random alphanumeric string of length 10. By default, the value ...
Read now
Unlock full access