• +91 9723535972
  • info@interviewmaterial.com

ReactJS Interview Questions and Answers

Related Subjects

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'}
   }
 }
}

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners