One button click navigate to route path in reactjs

On click of element if we want to navigate route path-

import { useHistory } from "react-router-dom"; 
< button onclick="{handleClick}" type="button"> 
 home
</button>

const history = useHistory(); 

function handleClick() {           history.push("/home"); 
}

Comments

Popular posts from this blog

world tourism guide Template

Es6 how to check if value is not null or undefined?