react-enhanced-route

1.0.5 • Public • Published

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

Package Sidebar

Install

npm i react-enhanced-route

Weekly Downloads

2

Version

1.0.5

License

MIT

Last publish

Collaborators

  • bombellos