Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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 });
    }
}
Comment

remove state from location on page load in react router dom

history.replace('', null);
Comment

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 });
    }
}
Comment

remove state from location on page load in react router dom

history.replace('', null);
Comment

PREVIOUS NEXT
Code Example
Javascript :: passport restarting server why 
Javascript :: adding growl delete notifications in vanilla js 
Javascript :: json identifier with period 
Javascript :: winston exclude routes 
Javascript :: expressjs4 async 
Javascript :: 4. You want to print the incremental count each time you instantiate a object using new in JS 
Javascript :: hoverintent.min.js wordpress error 
Javascript :: leaflet draw save event 
Javascript :: vue get component hash 
Javascript :: populate DataTable from django json 
Javascript :: u017f javascript 
Javascript :: puppeteer wait for select[name= 
Javascript :: how to query in windows js 
Javascript :: angular 4200 on ec2 access is localhost 
Javascript :: how long does razor burn last 
Javascript :: react how to block render if data is not fetched yet 
Javascript :: openseamap nodejs github 
Javascript :: use jquery in jsbench me 
Javascript :: change linear bagckgorund by javascript 
Javascript :: diynamic time vue js 
Javascript :: JavaScript Operator Precedence Values 
Javascript :: put my angular project in subfolder. 500 INTERNAL ERROR 
Javascript :: immutable to object javascript 
Javascript :: media query for mobile in react file 
Javascript :: altenrive for react native 
Javascript :: stop playing music when page is closed react 
Javascript :: hooks in bdd 
Javascript :: how to use begins with in aws nodejs 
Javascript :: 4.7.2. Compound Assignment Operators¶ 
Javascript :: URIError 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =