As the title says, I have two buttons that have the exact same format, but one is refreshing the page when clicked instead of submitting the form. I just need it to trigger a toast.
Here's the working button:
<button
type="submit"
className="btn btn-primary my-2 my-sm-0"
style={{ marginTop: "10px" }}
onClick={() => onSubmit()}
>
<i className="fas fa-search"></i>
</button>
And here is the not working button:
<button
type="submit"
className="btn btn-primary my-2 my-sm-0"
style={{ marginTop: "10px" }}
onClick={() => onSubmit()}
>
<i className="fas fa-paper-plane"></i>
</button>
The only difference is the first one is wrapped in a Link tag to submit a search, while the other will be submitting an email to subscribe to a newsletter, but it should just trigger a toast for now.
Help?
Also, I've tried event.preventDefault already (didn't work), and both are in the exact same form format as well.