# react-router-private

> Private route component for React &amp; React Router

Latest version **1.0.16** (published 2018-08-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-router-private
pnpm add react-router-private
yarn add react-router-private
bun add react-router-private
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.16 |
| Published | 2018-08-28 |
| First published | 2018-08-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | barisozcetin |
| Maintainers | barisozcetin |

## Links

- npm: https://www.npmjs.com/package/react-router-private
- Repository: https://github.com/barisozcetin/react-router-private
- npm.io page: https://npm.io/package/react-router-private

## Recent versions

- 1.0.16 (latest) — 2018-08-28
- 1.0.15 — 2018-08-28
- 1.0.14 — 2018-08-28
- 1.0.13 — 2018-08-28
- 1.0.12 — 2018-08-28
- 1.0.11 — 2018-08-28
- 1.0.10 — 2018-08-28
- 1.0.9 — 2018-08-28
- 1.0.8 — 2018-08-28
- 1.0.7 — 2018-08-28
- 1.0.6 — 2018-08-28
- 1.0.5 — 2018-08-28
- 1.0.4 — 2018-08-28
- 1.0.3 — 2018-08-28
- 1.0.2 — 2018-08-28
- … 2 more at https://npm.io/package/react-router-private/versions

## README

# react-router-private

> Private route component for React & React Router

[![NPM](https://img.shields.io/npm/v/react-router-private.svg)](https://www.npmjs.com/package/react-router-private) 

## Install

```bash
npm install --save react-router-private
```

## TODO

> Add example

## Usage

```jsx
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](https://github.com/barisozcetin)

---
_Source: https://npm.io/package/react-router-private · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
