0.1.4 • Published 6 years ago

@ionx/react-routing v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

React Routing

Simple page router for React with minimal dependencies

NPM JavaScript Style Guide

Install

npm install --save @ionx/react-routing

Basic Usage

Simple usage without redux:

import React from 'react'
import { render } from 'react-dom'
import { Router } from 'react-routing'

const Page1 = props => <h1>Page 1</h1>
const Page2 = props => <h1>Page 2</h1>

const App = (
  <Router routes={{
    '/uno': Page1,
    '/dos': Page2,
    '': '/uno' // Default handler redirects to /uno
  }} />
)

render(App, document.getElementById('root'))

It is recommended to use React-Routing with redux, in which case the LocationReducer should be registered with createStore, and the funcion bindHistory(store) should be called after the store is created.

For a complete example using Redux, see the example folder.

License

MIT © PowerOfM

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago