Answers for "can you pass actions in the history.push react js"

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

history.push({
  pathname: '/path',
  customNameData: yourData,
});
Posted by: Guest on July-28-2020

Code answers related to "can you pass actions in the history.push react js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language