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

PREVIOUS NEXT
Code Example
Javascript :: add even numbers recursion js 
Javascript :: node.js check if a remote URL exists 
Javascript :: check if s3 bucket exists in lambda 
Javascript :: Reduce array to a single string using reduce 
Javascript :: wait for 1 second in loop in javascript 
Javascript :: abrir dialog angular materia 
Javascript :: fizz buzz program in javascript 
Javascript :: appendchild javascript 
Javascript :: datatable set row id 
Javascript :: leaflet tile service 
Javascript :: puppeteer event element change 
Javascript :: form-data upload file 
Javascript :: dynamically add/remove rows in html table using javascript 
Javascript :: how to use if else inside jsx in react 
Javascript :: socket..io 
Javascript :: form.reset function in javascript 
Javascript :: js scroll to bottom exact 
Javascript :: usb react native device not found 
Javascript :: mongoose connection increase timeout in node js 
Javascript :: mongoose filter 
Javascript :: javascript valueOf() Method 
Javascript :: javascript console.log 
Javascript :: try catch javascript 
Javascript :: upload and send file to axios multipart 
Javascript :: apache react deploy "conf" 
Javascript :: javascript how to merge arrays 
Javascript :: entypo icons react native 
Javascript :: jquery placeholder 
Javascript :: Conditionally pass props to react component 
Javascript :: how to create a point in js 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =