I am assuming you have
<form onSubmit={someFunction}>
// Your submit button somewhere here
</form>
And you want to redirect user to a different page when the user clicks the submit button. I would approach it this way,
constructor(props) {
super(props);
this.state = { redirect: false }
}
handleSubmit() {
// do some check before setting redirect to true
this.setState({ redirect: true });
}
render() {
// you could reset the this.state.redirect to false here before redirecting a user
if (this.state.redirect) return <Redirect to='some url' />;
else return (
<div>
<form onSubmit={this.handleSubmit.bind(this)}>
<button type='submit'> Continue </button>
</form>
</div>
)
}
Idea is when the user clicks submit, it updates state, re-renders the component and see if redirect is true, if so it will redirect the user to the page. I think it is awkward to wrap Link that is not supposed to work as a button -IMO.