score:1

Accepted answer

you forgot to wrap your component using withrouter

export default withrouter(login);

note: in your post you write this

route path="/login" render={() => login } exact 

which is wrong (unless it is a typo), it should be,

<route path="/login" render={() => <login /> } exact />

score:0

the thing that's undefined is most likely "this.props.location". did you remember to wrap the component in "withrouter"? if not, you won't have access to it.


Related Query

More Query from same tag