How to use history push within function component with parameters?
function Button({ path, text }) {
const history = useHistory();
function handle(){
history.push(path); // This should work now
}
return(
<button onClick={handle}>
{text} // This should render now
</button>
);
}
How to use history push within function component with parameters?
function Button({ path, text }) {
const history = useHistory();
function handle(){
history.push(path); // This should work now
}
return(
<button onClick={handle}>
{text} // This should render now
</button>
);
}