# react-subrouter

> A react-router inspired subrouting library

Latest version **0.3.1** (published 2015-07-15) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install react-subrouter
pnpm add react-subrouter
yarn add react-subrouter
bun add react-subrouter
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.1 |
| Published | 2015-07-15 |
| First published | 2015-05-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | ugnis |
| Keywords | react, subrouter, react-component, routing, route, routes, router |

## Links

- npm: https://www.npmjs.com/package/react-subrouter
- Repository: https://github.com/UgnisSoftware/react-subrouter
- Homepage: https://github.com/UgnisSoftware/react-subrouter#readme
- Issues: https://github.com/UgnisSoftware/react-subrouter/issues
- npm.io page: https://npm.io/package/react-subrouter

## Dependencies (1)

- [babel-runtime](https://npm.io/package/babel-runtime.md) ^5.7.0

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 0.3.1 (latest) — 2015-07-15
- 0.2.1 — 2015-07-15
- 0.2.0 — 2015-07-15
- 0.1.3 — 2015-05-26
- 0.1.2 — 2015-05-25
- 0.1.1 — 2015-05-25
- 0.0.1 — 2015-05-25

## README

# react-subrouter

When you need to change views without changing the URL.

SubRouted Components can be in any part of your application.

There can be multiple SubRouters

API is closely aligned with react-router's (SubLink, SubRouteHandler, etc...)

Examples at [react-subrouter-examples](https://github.com/UgnisSoftware/react-subrouter-examples)

## Usage

Request Libraries
```javascript
  import React from 'react';
  import {SubRoute, SubRouter, SubLink, SubRouteHandler} from 'react-subrouter';
```

[Define SubRoutes](https://github.com/UgnisSoftware/react-subrouter-examples/blob/master/src/views/modal/routes.js)
```javascript
  var routes = (
    <SubRoute handler={Modal}>
      <SubRoute name="deposit" handler={Deposit}>
        <SubRoute name="card" handler={Card}/>
        <SubRoute name="bank" handler={Bank}/>
      </SubRoute>
      <SubRoute name="status" handler={Status}/>
      <SubRoute name="info" handler={Info}/>
    </SubRoute>
  };
```

[Build a new SubRouter](https://github.com/UgnisSoftware/react-subrouter-examples/blob/master/src/views/modal/index.js)
```javascript
    class Index extends SubRouter {
        constructor(props, state){
            super(props, state, routes, 'card');
        }
    }
```

[Start building nested SubRoutes](https://github.com/UgnisSoftware/react-subrouter-examples/blob/master/src/views/modal/components/modal.js)

```javascript
export default class extends React.Component{
    render() {
        return (
            <div className="modal">
                <div className="tabs">
                    <SubLink to="status" className="tab three">Status</SubLink>
                    <SubLink to="deposit" className="tab three">Deposit</SubLink>
                    <SubLink to="info" className="tab three">Info</SubLink>
                </div>
                <SubRouteHandler />
            </div>
        );
    }
}
```

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