Skip to content

FxxxdChicken/react-router-condition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-router-condition

react-router-condition

install

npm i --save react-router-condition

use case 1

import { ConditionRedirectRoute as Route } from "react-router-condition";
    
<Route path="/setting" condition={checkAuth()} component={Setting} redirectURL="/" />

use case 2

import { ConditionComponentRoute as Route } from "react-router-condition";
    
<Route path="/setting" condition={checkAuth()} component={Setting} failComponent={Login} />

use case 3

import { PrivateRoute } from "react-router-condition";
    
<PrivateRoute condition={checkAuth()}  redirectURL="/">
    <Route path="/setting" Compontent={Setting} />
    <Route path="/profile" Compontent={Profile} />
<PrivateRoute />

use case 4

import { PrivateRoute } from "react-router-condition";
    
<PrivateRoute condition={checkAuth()}  redirect={Login}>
    <Route path="/setting" Compontent={Setting} />
    <Route path="/profile" Compontent={Profile} />
<PrivateRoute />

Todo

hi

About

react-router-condition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published