Skip to content

Instantly share code, notes, and snippets.

@clalimarmo clalimarmo/url_store.js
Last active Sep 21, 2015

What would you like to do?
Deep Linking with React + Flux, URL Store, with support for browser "back"
(function() {
Dispather.register(function(action) {
if (action.type !== 'navigate') {
// sometimes we don't want to create history entries (see below)
if (action.pushState) {
{path: action.path},
window.onpopstate = function(event) {
// only handle browser back if our app created the history entry
if (event.state.path) {
type: 'navigate',
path: event.state.path,
// navigating back shouldn't add anything to the browsing history
pushState: false,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.