in React JS by

How to perform automatic redirect after login?

1 Answer

0 votes
  1. The react-router package provides <Redirect> component in React Router. Rendering a <Redirect> will navigate to a new location. Like server-side redirects, the new location will override the current location in the history stack.

    import React, { Component } from 'react'
    import { Redirect } from 'react-router'
    export default class LoginComponent extends Component {
      render() {
        if (this.state.isLoggedIn === true) {
          return <Redirect to="/your/redirect/page" />
        } else {
          return <div>{'Login Please'}</div>

Click here to read more about React JS
Click here to read more about Insurance

Related questions

0 votes
asked Feb 2 in Sql by SakshiSharma
+1 vote
asked May 29, 2020 in React JS by anonymous
0 votes
asked Aug 29, 2020 in Python by Robindeniel
+1 vote
asked Aug 22, 2019 in Selenium by john ganales
0 votes
asked May 14, 2019 in Other by Robindeniel