Simple Conditional Routing in Reactjs

后端 未结 6 688
一整个雨季
一整个雨季 2020-11-28 05:01

How to make conditional Routing, if and only if some conditions satisfies then only routing should happen. for example, if and only if the user enters the correct credential

6条回答
  •  温柔的废话
    2020-11-28 05:58

    I would like to join the party with simple solution.

    Just conditional render in the component prop in as follows:

    
      
      
           
    Loading posts...
    : () => } />

    Here i am trying to fetch some data from an api when it fetched (loading) should be false and renders Home component.

提交回复
热议问题