React `useHistory`hook
Jan 16, 2021
Use to useHistory change pages Suppose we put a button on the home page
We want to go to the about page by pressing that button
To do this we use useHistory.To use this hook, follow the procedure below:
1- import {useHistory} from ‘react-router-dom’;inside function2- const history = useHistory(); 3- const apply = () => {
history.push('about');
}4- <button onClick={apply}>Login</button>