New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onSubmitted not working with functions #45
Comments
Hi, i dont know what is |
Hi, history.push is taken from react router's useHistory() - it allows you to programatically set the next route. Unf no luck, I've tried |
strange ! if you get a repro on codesandbox.io or something i'll have a look |
I realise this is a very old issue, but this is a solution that is working for me - I added a useEffect hook inside of the customForm component just to run the redirect.
|
Hi
I'm trying to redirect the user to a thank you page based on whether the status flag is "success" or not. Unf the status is unknown at the time of clicking the submit link/button so I can't add the path as so what I've thought of doing is adding onSubmitted on the rendered CustomForm and calling a simple function that will check the status and take the user to a different route (using react router history.push). The function isn't being hit at all though yet when I instead swap it out for a console.log it works.
const back = () => { history.push("/thank-you") };
Any ideas?
Cheers!
The text was updated successfully, but these errors were encountered: