Question - How to perform automatic redirect after login?
Answer -
The react-router package will provide the component in React Router. Rendering of a component will navigate to a newer location. In the history stack, the current location will be overridden by the new location just like the server-side redirects.
import React, { Component } from 'react'
import { Redirect } from 'react-router'
export default class LoginDemoComponent extends Component {
render() {
if (this.state.isLoggedIn === true) {
return
} else {
return
{'Please complete login'}
}
}
}