0

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:

First Link

Second Link

Third Link

I have searched on above site but didn't get the perfect solution. Please help me.

Hkh
  • 357
  • 1
  • 10

0 Answers0