# c-router

> custom react router-accepts layouts and components

Latest version **1.0.17** (published 2020-03-09) · MIT license · 0 weekly downloads

## Install

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

## 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.17 |
| Published | 2020-03-09 |
| First published | 2019-12-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 0 |
| Unpacked size | 10.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | homericks |
| Maintainers | erichomes |
| Keywords | router, c-router, custom-router, react-router |

## Links

- npm: https://www.npmjs.com/package/c-router
- Repository: https://github.com/RickHomes/React-Custom-Router
- Homepage: https://github.com/RickHomes/React-Custom-Router#readme
- Issues: https://github.com/RickHomes/React-Custom-Router/issues
- npm.io page: https://npm.io/package/c-router

## 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

- 1.0.17 (latest) — 2020-03-09
- 1.0.16 — 2020-01-06
- 1.0.15 — 2020-01-06
- 1.0.14 — 2020-01-05
- 1.0.13 — 2020-01-01
- 1.0.12 — 2019-12-28
- 1.0.11 — 2019-12-28
- 1.0.10 — 2019-12-28
- 1.0.9 — 2019-12-28
- 1.0.8 — 2019-12-28
- 1.0.7 — 2019-12-28
- 1.0.6 — 2019-12-28
- 1.0.5 — 2019-12-21
- 1.0.4 — 2019-12-11
- 1.0.3 — 2019-12-11
- … 3 more at https://npm.io/package/c-router/versions

## README

# c-router

> custom react router-accepts layouts and components

[![NPM](https://img.shields.io/npm/v/c-router.svg)](https://www.npmjs.com/package/c-router) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

## Install

```bash
npm install --save c-router
```

## Usage

```jsx
// App.js
import React, { Component } from "react";
import CRouter from "c-router";
import { appRoutes } from "./Routes";
class App extends Component {
  render() {
    return <CRouter routes={appRoutes} />;
  }
}
ReactDOM.render(<App />, document.getElementById("root"));

// Routes.js
import { Home, AboutUs } from "./pages";
import { DefaultLayout, EmptyLayout } from "../layouts";

export const appRoutes = [
  {
    exact: true,
    comp: Home,
    path: "/",
    layout: DefaultLayout
  },
  {
    exact: false,
    comp: AboutUs,
    path: "/AboutUs",
    layout: EmptyLayout
  }
];

//Layouts

// EmptyLayout.js
import React from "react";
import AppBar from "./AppBar";

export default function EmptyLayout({ children }) {
  return (
    <div>
      {/* our content goes in here */}
      {children}
    </div>
  );
}

// DefaultLayout
import React from "react";

export default function DefaultLayout({ children }) {
  return (
    <div>
      <AppBar />
      {children}
    </div>
  );
}

// pages/Views

// Home.js

import React from "react";

export default function HomePage() {
  return (
    <div>
      <p>Welcome to CRoute HomePage</p>
    </div>
  );
}
// AboutUs.js

import React from "react";
export default function AboutUs() {
  return (
    <div>
      <p>About us page</p>
    </div>
  );
}
```

## License

MIT © [homericks](https://github.com/homericks)

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