Skip to content
This repository has been archived by the owner on Oct 26, 2018. It is now read-only.

example with react-router 2.x #181

Closed
bdefore opened this issue Jan 9, 2016 · 10 comments
Closed

example with react-router 2.x #181

bdefore opened this issue Jan 9, 2016 · 10 comments

Comments

@bdefore
Copy link
Contributor

bdefore commented Jan 9, 2016

Does the latest version 2.0.1 work with react router 2.0.0-rc4? Is there an example for how to get this to work?

@bdefore
Copy link
Contributor Author

bdefore commented Jan 9, 2016

My attempt to get this to work with my universal-redux npm library (https://github.com/bdefore/universal-redux) is not working. Following along the example in this repo (which works with react-router 1.0.0) I'm attempting to apply syncHistory to the new 2.0 instance of browserHistory

I'm setting up my reducers, including routing: routeReducer here: https://github.com/bdefore/universal-redux/blob/master/examples/jwt/src/redux/modules/index.js#L9

This then gets passed to the client here in the import of reducers: https://github.com/bdefore/universal-redux/blob/master/src/client.js#L11

At which point my createStore helper assembles the middleware: https://github.com/bdefore/universal-redux/blob/master/src/shared/create.js

But when I load up my app, path is not available in props, which I'm using @connect to map to state.routing.path

@bdefore
Copy link
Contributor Author

bdefore commented Jan 9, 2016

I've updated my JWT example to be a good base to investigate: https://github.com/bdefore/universal-redux/tree/master/examples/jwt

When running npm run dev from the example, I see the warning:

Warning: Failed propType: Required prop `path` was not specified in `App`. Check the render method of `Connect(App)`.

@bdefore
Copy link
Contributor Author

bdefore commented Jan 9, 2016

Ah, I see my issue. It's no longer on the reducer as path but location, which is an object with pathname, query, search etc.

@bdefore bdefore closed this as completed Jan 9, 2016
@bdefore
Copy link
Contributor Author

bdefore commented Jan 9, 2016

Reopening, since an example here or updated docs would still help.

@bdefore bdefore reopened this Jan 9, 2016
@iyn
Copy link

iyn commented Jan 10, 2016

I can't get redux-simple-router working with the react-router 2.0. I'm using hashHistory and when I try to run syncReduxAndRouter:

syncReduxAndRouter(hashHistory, store);

I get an error:

Uncaught TypeError: (0 , _reduxSimpleRouter.syncReduxAndRouter) is not a function

So yeah, I'd also want to see example how to use redux-simple-router with the latest router ;).

@SimenB
Copy link
Contributor

SimenB commented Jan 10, 2016

syncReduxAndRouter is removed, use const router = syncHistory(hashHistory); and router.syncHistoryToStore(store);

@bryce-larson
Copy link

+1

@iyn
Copy link

iyn commented Jan 11, 2016

@SimenB: thanks!

@yocontra
Copy link

It would be cool if there was documentation for the latest version (2.x release)

@jlongster
Copy link
Member

@contra There's a PR to update it (waiting for them to change something) and once it's merged I'll officially release 2.0.0 and make sure everything is up-to-date.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants