How can we pass parameter with this.props.history.push(\'/page\')
in React-Router v4?
.then(response => {
var r = this;
if (re
React TypeScript with Hooks
From a Class
this.history.push({
pathname: "/unauthorized",
state: { message: "Hello" },
});
UnAuthorized Functional Component
interface IState {
message?: string;
}
export default function UnAuthorized() {
const location = useLocation();
const message = (location.state as IState).message;
return (
{message}
);
}