Unable to redirect at other page in react js. Using below code :
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';
handleClick = () => {
browserHistory.push('/login');
};
setRedirect = () => {
this.setState({
redirect: true
})
}
On render function :
<button onClick={this.setRedirect}>Redirect</button>
I have searched the following link on stack overflow:
I have searched on above site but didn't get the perfect solution. Please help me.