react-router-private
v1.0.16
Published
Private route component for React & React Router
Downloads
7
Readme
react-router-private
Private route component for React & React Router
Install
npm install --save react-router-private
TODO
Add example
Usage
import React, { Component } from 'react'
import { BrowserRouter as Router, Route } from 'react-router-dom'
...
import PrivateRoute from 'react-router-private'
class Example extends Component {
render () {
return (
<div className="app" >
<Router>
<Route path ="/" exact component={home}></Route>
<PrivateRoute path="/profile" exact component={Profile} authStatus={this.state.authStatus} redirectURL="/login"/>
<PrivateRoute path="/another-route" component={Profile} authStatus={this.state.authStatus} nonLoggedInComponent={AlternativeComponent} />
</Router>
</div>
)
}
}
License
MIT © barisozcetin