1.1.1 • Published 5 years ago

corolla v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago