i'm trying to set up a redirect inside of a function after i set a cookie.
I had tried using redirect with history and a bunch of other but they each gives me a different error
const Form = () => {
const { values, handleChange, handleSubmit } = useForm(SignUp);
function SignUp() {
axios.post('http://localhost:3000/users', {
"name": values.name,
"email": values.email,
"password": values.password
})
.then(function (response) {
bake_cookie('jwtToken', response.data.token)
//trying to redirect after this line
})
}
return (
<div>
<Container component="main" maxWidth="xs">
</Container>
</div>
)
}