Closed tommulkins closed 6 years ago
Oops, PLEASE IGNORE: I did not pass the history prop to the correct render method. Passing it to render function in the Route component works just fine.
please show me how
Not saying this is what was meant or what is the best practice, but you can pass things around this way.
# In App
<NavBar location={location} history={history} expanded={expanded}/>
# In NavBar
...
if (this.props.location.pathname !== to) {
this.props.history.push(to);}
}}
...
The history prop passed into the render function then used to history.push("/") appears to break due to history being a restricted global keyword. Unfortunately //eslint-disable-next-line before history.push() does not fix the problem. Calling onCreateContact will then complain "TypeError: history.push is not a function."
I'm using Firefox Developer Edition 59.0b3 on Linux.