Answers for "history push search params"

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
1

history push search params

this.props.history.push({
    pathname: '/client',
    search: "?" + new URLSearchParams({clientId: clientId}).toString()
})
Posted by: Guest on May-16-2020

Code answers related to "history push search params"

Code answers related to "Javascript"

Browse Popular Code Answers by Language