handleLogin() {
const { username, password } = this.state;
if (username === 'test' && password === '1234') {
this.setState({ error: false });
auth.authenticate();
alert('done')
return <Redirect to="/"/>
} else {
this.setState({ error: true });
}
}
This function is an onClick handler for my buttong.
Whenever I type in the right id and pw, I intend to redirect the user to the "/"
route.
The alert gets called but it doesn't get redirected to the path.
Is this the right usage?