Reputation: 1
add the history in top of the code like `import {history} form react-router-dom
history.push({
pathname:"/users",
state:{
Key : response.data.user }
});
Upvotes: 0
Views: 966
Reputation: 944455
See the upgrade guide in the documentation.
Use useNavigate instead of useHistory
let navigate = useNavigate();
const someFunction = () => {
const options = {
state: {
Key: response.data.use
}
}
navigate("/users", options);
}
Upvotes: 2