Answers for "using history.push react to reatian state'"

4

history.push with params

import { useHistory } from "react-router-dom";

const FirstPage = props => {
    let history = useHistory();

    const someEventHandler = event => {
       history.push({
           pathname: '/secondpage',
           search: '?query=abc',
           state: { detail: 'some_value' }
       });
    };

};

export default FirstPage;
Posted by: Guest on August-26-2020
0

how to get state value from history react

this.props.location.customNameData // it is equal to yourData
Posted by: Guest on July-28-2020

Code answers related to "using history.push react to reatian state'"

Code answers related to "Javascript"

Browse Popular Code Answers by Language