1.1.12 • Published 4 years ago

private-route-react v1.1.12

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

private-route-react

private-route-react is a library to handle private routing of react-router-dom instead of creating it manually.


Installation

Use the package manager npm to install private-route-react

npm install private-route-react

Usage

import PrivateRoute from 'private-route-react';

<PrivateRoute path={routePath} component={Component} isAbleToAccessRoute={isAbleToAccessRouteFunction} redirectPath={redirectPath} />
propertyDescription
pathrouting path you want to go to
componentcomponent you want to render in this path
isAbleToAccessRoutefunction which have to return boolean to check if he isa able to go to that path or not
redirectPathrouting path to go to if he is not allowed to go to that path

Example

  • isLoggedIn.js

      const isLoggedIn = ()=> false;
      export default isLoggedIn;
  • app.js

      import PrivateRoute from 'private-route-react';
      import isLoggedIn from './isLoggedIn.js';
      import ComponentA from './Component';
    <PrivateRoute path={'/profile'} component={ComponentA} isAbleToAccessRoute=   {isLoggedIn} redirectPath={'/login'} />

Tests

made using Jest to check tests run

npm run test

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.


License

MIT

1.1.1

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.12

4 years ago

1.1.11

4 years ago

1.1.10

4 years ago

1.1.0

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.26

4 years ago

1.0.27

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.23

4 years ago

1.0.19

4 years ago

1.0.18

4 years ago

1.0.17

4 years ago

1.0.16

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.9

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago