react-enhanced-route
v1.0.5
Published
React Enhanced Route - define custom layouts for your routes, prevent from accessing protected routes!
Downloads
11
Maintainers
Readme
react-enhanced-route
react-enhanced-route
allows you to create react routes with custom layouts and routes which require authentication.
Getting started
Install and add package as dependency by running one of below commands.
Using npm:
npm install react-enhanced-route
Using yarn:
yarn add react-enhanced-route
Import package and follow the examples below:
import {EnhancedRoute as Route} from 'react-enhanced-route'
Examples
Create route with custom layout
<Route path="/home" component={HomePage} layout={MainLayout} />
Create protected route
<Route path="/admin" auth={isAuthorized} component={AdminPage} />
Create protected route with redirection and layout
<Route path="/admin" auth={isAuthorized} redirect={'/login'} component={AdminPage} layout={AdminLayout} />
For live examples click below:
License
MIT