fromComponent.js
const history = useHistory();
const handleUserSubmitData = () => {
history.push("/");
};
<Form onSubmit={() => handleUserSubmitData}>
</Form>
After submitting it is redirected to /? not to /. could you please help me out to solve this issue?
CodePudding user response:
You aren't calling the handleUserSubmitData function
Update the line as follow
...
<Form onSubmit={() => handleUserSubmitData()}> // call function here by adding parentheses //()
...
Hope this will solve your issue.