Answers for "history push with params react-router-dom"

5

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

react history push search params

pathname, search
Posted by: Guest on November-04-2021

Code answers related to "history push with params react-router-dom"

Code answers related to "Javascript"

Browse Popular Code Answers by Language