September 2018
Beginner
156 pages
3h 28m
English
The <Link> and <NavLink> components render anchor links on the page, which allow you to navigate from the current route to the new route. However, in many cases, the user should be navigated to a new route programmatically when an event occurs. For example, the user should be navigated to a new route upon clicking the Submit button in the login form. The history object available to the rendered component can be used in such cases:
export const DashboardComponent = (props) => ( <div className="dashboard"> Inside Dashboard route <button onClick={() => props.history.push('/user')}> User </button> </div>);
Here, the DashboardComponent receives props as its argument, which contains the history ...
Read now
Unlock full access