I have a form and I want the onSubmit function to contain a switch or an if that routes to different pages depending on form submit.
For example consider the following onSubmit function body: (but where goTo is an executable JS function that routes to /account, /blog, etc.)
'''
if (formData == 1) {
goTo('/account');
}
else if (formData == 2) {
goTo('/blog');
}
else if (formData == 3) {
goTo('/about');
}
else {
goTo('/');
}
'''
I am using next react next link and react-router. If you know of any libraries that would be useful for this please let me know.