I have a react hook form setup to validate using yup and that works perfectly okay. When I click a Continue button it validates fields and shows error messages against them. However, I'm unsure how it is supposed to work when all validation fields have been entered correctly. As far as I can see the function specified in handleSubmit(someFunc) is called if all validation is complete. In my scenario it has been instigated by an RRLink as below...so Continue button clicked, assume everything is valid, it then hits onSubmit() function, what about the RRLink with the toPath...that navigation to another page seems to be lost now...How do I make it so it picks up the RRLink navigate to another page when valid?
const onSubmit = (data) => {
console.log("SUBMIT:" + data);
};
<RRLink onClick={handleSubmit(onSubmit)} to={{ pathname: `/${summaryPath}` }} tabIndex="-1" className="mp-react-router-link">
<Button type="submit" >
Continue
</Button>
</RRLink>