When I push pathname
and state
to history
, it will push successfully but when I print console.log(this.props.history)
in pathname
component then it showing undefined
.
I already use withRouter hoc to default export.
It happens only in my project. Because when I try into the other test project it works fine but in another project, it does not work.
Please give me the solution to this.
this.props.history.push({
pathname: "/test-pathname",
state: { data: "Hello" }
});
/test-pathname
console.log(this.props.history); //showing undefine
question from:
https://stackoverflow.com/questions/65839490/this-props-history-showing-undefine-in-console 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…