🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

alt-router

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alt-router

Connect react-router to alt

1.0.3
npm
Version published
Weekly downloads
2
-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

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 })

Keywords

react-router

FAQs

Package last updated on 15 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts