useHistory – Cannot read property ‘push’ of undefined

You are trying to use history hook outside of Router. Write your function inside Header component.

Try this inside Header component

const history = useHistory();

const homeButtonOnClickHandler = () =>{

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top