Answers for "react router remove location state on refresh"

0

react router remove location state on refresh

import createHistory from 'history/createBrowserHistory'

...

componentDidMount(){
    const history = createHistory();
    if (history.location.state && history.location.state.transaction) {
        let state = { ...history.location.state };
        delete state.transaction;
        history.replace({ ...history.location, state });
    }
}
Posted by: Guest on November-12-2020

Code answers related to "react router remove location state on refresh"

Code answers related to "Javascript"

Browse Popular Code Answers by Language