How to set the DefaultRoute to another Route in React Router

前端 未结 11 1243
心在旅途
心在旅途 2020-12-13 02:11

I have the following:

  
    
            


        
11条回答
  •  攒了一身酷
    2020-12-13 02:29

    The problem with using is if you have a different URL, say /indexDashboard and the user hits refresh or gets a URL sent to them, the user will be redirected to /searchDashboard anyway.

    If you wan't users to be able to refresh the site or send URLs use this:

     (
        
    )}/>
    

    Use this if searchDashboard is behind login:

     (
      loggedIn ? (
        
      ) : (
        
      )
    )}/>
    

提交回复
热议问题