# clean-router

> cleaner way to declare routes in reactjs using the React-router-dom

Latest version **1.0.2** (published 2022-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install clean-router
pnpm add clean-router
yarn add clean-router
bun add clean-router
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-10-25 |
| First published | 2022-10-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 24.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gideon Ifeanyi Mmeremnwanne |
| Maintainers | mmeremnwanne |
| Keywords | react, react-router-dom, clean router implementation, react-component |

## Links

- npm: https://www.npmjs.com/package/clean-router
- Repository: https://github.com/gami34/clean-router
- Homepage: https://github.com/gami34/clean-router.git
- Issues: https://github.com/gami34/clean-router/issues
- npm.io page: https://npm.io/package/clean-router

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2022-10-25
- 1.0.1 — 2022-10-25
- 1.0.0 — 2022-10-25

## README

# clean-router

> Made with create-react-library

[![NPM](https://img.shields.io/npm/v/clean-router.svg)](https://www.npmjs.com/package/clean-router) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save clean-router
```

## Usage

```tsx
import React, { Component } from 'react'
import { useCleanRouter } from 'clean-router'

class Example extends Component {
  
  const [mainRouteHandler, subRouteHandler] = useCleanRouter(<Loader />)

  render() {
    return (
      <Router>
        {mainRouteHandler("/dash", <DashOutlet>, [
            subRouteHandler("", <Home />),                     // /dash/
            subRouteHandler("profile", <Profile />),           // /dash/profile   
            subRouteHandler("email", <EmailOutlet />, [
              subRouteHandler("", <Inbox />),                  // /dash/email
              subRouteHandler("spam", <Spam />),               // /dash/email/spam
            ]),
        ])}
      </Router>)
  }
}
```

## Note

The utility can handle up to 4 level deep routes with param and text counting as one, e.g "user/:userId" is considered as a single count. also "acount/:accountId/:planId" is also a single count"

example of a 4 level deep routes as mentioned above
/dash/account/credit/internal

## Contributions and Suggestion

you can contribute to the utility as that will be greately appreciated.

## License

MIT © [gami34](https://github.com/gami34)

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