I am using react-router with react js and i following their documentation but facing this error
while compiling it shows the error,
TypeError: _this.
I had something like:
and AuthLayout was a component in which I was switching between SignIn and SignUp components, like below:
{ login ? : }
I faced this error of this.props.history is not a function inside these components. It was because I hadn't used those components directly inside the router. I had access to this.props.history inside the AuthLayout and I had to pass it to its children.
So I did it:
{ login ? : }
and the problem solved.