1.0.3 • Published 3 years ago

react-route-protected v1.0.3

Weekly downloads
4
License
UNLICENSED
Repository
github
Last release
3 years ago

ReactProtectedRoute

Protected react route. Use for redirect users to login page from private pages.

Installation

npm i react-route-protected

Usage

import { Switch } from 'react-router-dom';
...
<Switch>
    ...
    <ReactProtectedRoute
        path="/path-to-private-component"
        component={PrivateComponent}
        authPath="/login"
        isAuthorized={authCondition}
    />
    ...
</Switch>

Props

  • path - the same as path of Route component.
  • component - the same as component of Route component.
  • isAuthorized - if this condition is true user will be redirected
  • authPath - path to redirect
1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago