Answer the question
In order to leave comments, you need to log in
Why is redirect not happening?
Good afternoon! The task is the following, with a successful request, you need to make a redirect, to solve this problem, I wrote this function:
const addNumberHandler = async () => {
try {
await axios.post('/newNumber/', obj, {
headers: {
'Content-Type': 'application/json'
}
})
.then(res => {
if (res.data.status === 201) {
return <Redirect to="/"/>;
}
});
} catch (e) {
console.log(e);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question