Last active
May 19, 2016 08:32
-
-
Save jrwebdev/007c27fc238b6616a65a78f1d559a4c0 to your computer and use it in GitHub Desktop.
redux-ui-router React wrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {stateGo} from 'redux-ui-router'; | |
const stateMap = { | |
'/': 'index', | |
'/page1': 'page1', | |
'/page2': 'page2' | |
} | |
const push = url => { | |
// getPath() and getParams() are example functions | |
const state = stateMap[getPath(url)]; | |
const params = getParams(url); | |
return stateGo(state, params); | |
} | |
const replace = url => { | |
const state = stateMap[getPath(url)]; | |
const params = getParams(url); | |
return stateGo(state, params, {location: 'replace'}); | |
} | |
export {push, replace} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment