📜  如何通过 history.push 传递参数? - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:11.376000             🧑  作者: 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;