I'm trying to navigate away from a view by pushing into the history object. However when I try to push a route into it, I get an error message:
Property 'push' does not exist on type 'History'.
render(){
return (
<div className="loginWrapper">
withRouter(({history}) => (<button onClick={()=>{history.push('/home')}} className="btn btn-primary">Pieteikties</button>))
</div>
)
}
What can I do to fix this?
EDIT:
I also tried this:
logIn(){
this.props.history.push('/new-location')
}
with a component like this:
render(){
return (
<div className="loginWrapper">
<button onClick={this.logIn} className="btn btn-primary">Pieteikties</button>
</div>
)
}
And it didn't work.