corolla
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

Corolla

npm npm GitHub license

React Router base on configuration and hooks

Installation

yarn add corolla

Usage

import React from 'react'
import ReactDOM from 'react-dom'
import { Router, Link } from 'corolla'
 
const Home = () => (
  <div>
    <Link to="/">Home</Link>
    <Link to="/about">About</Link>
    <h1>Home</h1>
  </div>
)
 
const About = () => (
  <div>
    <Link to="/">Home</Link>
    <Link to="/about">About</Link>
    <h1>About</h1>
  </div>
)
 
const NotFound = () => (
  <div>
    404 not found
  </div>
)
 
const routes = [
  {
    path: '/',
    component: Home,
  },
  {
    path: '/about',
    component: About,
  },
  {
    path: '**',
    component: NotFound,
  },
]
 
const App = () => <Router routes={routes} />
 
ReactDOM.render(<App />, document.getElementById('root'))

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i corolla

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

26.5 kB

Total Files

16

Last publish

Collaborators

  • forsigner