📜  history.push 与参数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:13.361000             🧑  作者: Mango

代码示例5
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;