Programmatically Navigate using react-router

前端 未结 8 1320
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 23:07

I am developing an application in which I check if the user is not loggedIn. I have to display the login form, else dispatch an action

8条回答
  •  盖世英雄少女心
    2020-11-21 23:32

    In react-router version 4:

    import React from 'react'
    import { BrowserRouter as Router, Route, Redirect} from 'react-router-dom'
    
    const Example = () => (
    
      if (isLoggedIn) {
        
    
      } else {
    
        
          
          
        
    
      }
    )
    
    const Login = () => (
        

    Form Components

    ... ) export default Example;

提交回复
热议问题