我必须通过 Link 将函数传递给另一个组件。
testFavorite=()=>{
console.log("work")
}
<Link
to={{
pathname: '/popular',
state:{
testFavorite: this.testFavorite
}
}}>
Popular</Link>
这就是我调用函数的方式
this.props.location.state.testFavorite();
但我有这个错误
history.js:370 未捕获的 DOMException:无法在“History”上执行“pushState”:function () { console.log("work"); 无法克隆。
我该如何解决?非常感谢