1.0.5 • Published 6 years ago

react-enhanced-route v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

react-enhanced-route

npm version CircleCI branch npm license

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:

Edit react-enhanced-route example

License

MIT