In this quick example i will show you how we can redirect user to specific page after submitting a form in react js. I will use react redirect after form submit functional component to show this example.
We need useHistory to get the push method. We will use this push to put out redirect url. Using this push method we will redirect user and complete our react redirect after form submit hooks tutorial.
See the below example:
import React from "react";
import { connect } from "react-redux";
import { Link, useHistory } from "react-router-dom";
const AdminSignatoryInfoCreatePage = () => {
const history = useHistory();
//after submit form redirect user
history.push('/admin/list');
return (
< div >
< / div >
)
}
export default connect(null,null)(AdminSignatoryInfoCreatePage);
Hope it can help you.
#react-js