I am using react-router version 5.3
I am navigating to a page like this, and setting state in it:
<Button
className="btn-neutral"
color="default"
size="sm"
onClick={() => {
props.onGetInputData(
props.applicationData.uniqueIdentifier,
props.applicationData.decisionLogId
);
props.history.push({
pathname: "/admin/input",
state: {
scoreCardDetail: props.location.state.scoreCardDetail
}
});
}}
>
Input
</Button>
However, when I do props.history.goBack(); the page goes to the previous page on the stack, but the state gets lost.
Is there any way I can go to the previous page and keep the state?