1.4.0 • Published 8 years ago

alt-router v1.4.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

alt-router

Setup

import AltRouter from 'alt-router'
import React from 'react'
import createBrowserHistory from 'history/lib/createBrowserHistory'

// your alt instance
import alt from '../alt'

const routes = (
  <Route path="/" component={App}>
    <Route path="about" component={About} />
    <Route path="inbox" component={Inbox} />
  </Route>
)

React.render((
  <AltRouter flux={alt} history={createBrowserHistory()} routes={routes} />
), document.getElementById('root'))

Changing routes

import alt from '../alt'

const changeRoute = () => {
  alt.router.pushState(null, '/home')
}

Bootstrap routes

For when you want to reload a user's entire application state including which route they were in

const bootstrapState = {
  state: null,
  pathname: '/notifications',
}

alt.bootstrap({ AltHistoryStore: bootstrapState })
1.4.0

8 years ago

1.3.0

8 years ago

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago