New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
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.4.0
latest
npm
Version published
Weekly downloads
0
-100%
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 23 Jan 2016

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