1.0.0 • Published 7 years ago

react-hash-routing v1.0.0

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

react-hash-router

A hash router for React

Install in your project

npm i react-hash-routing

Quick start

import React from 'react';
import HashRouter, {Route} from 'react-hash-routing';

export default class Sample extends React.Component {
  ...
  onLocationChanged (childKey, params, cb) {
      switch (childKey) {
        case 'home':
          cb()
          break
        case 'contacts':
          cb()
          break
        case 'customPage':
          cb()
          break
        default:
          cb()
          break
      }
    },
  render() {
    return (
      <HashRouter onLocationChanged={this.onLocationChanged}>
      	<Route key='home' hash='#/'>Home</Route>
      	<Route key='contacts' hash='#/contacts'>Contacts</Route>
      	<Route key='contacts' hash='#/contacts'>
      	    <YourCustomComponent />
      	</Route>
      </HashRouter>
    )
  }
}

Build sources

npm i

Develop mode

npm run develop

1.0.0

7 years ago

0.1.0

7 years ago

0.0.4

7 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago