Skip to content

Cowjiang/react-router-guard-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Router Guard Typescript

Description

react-router-guard-ts is based on react 18, react-router 6 and Typescript JSX. It can realize the function of authentication, guard, lazy load, loading status and check of route by configuration.

Basic Usage

router/guard.tsx

First, you need to save this file to ./router/guard.tsx

App.tsx

import RouterGuard from './router/guard'
import {routes, onRouteBefore} from './router'

function App() {
  return (
    <RouterGuard
      routers={routes}
      onRouterBefore={onRouteBefore}
    />
  )
}

router/index.ts

Routes routes list config
Authentication guard config
Auth check guard config

About

Route guard based on react18, react-router-v6 and Typescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors