Closed rynbyjn closed 8 years ago
Confused me for several hours. Please document or fix.
Related issue: https://github.com/rackt/redux-router/issues/159
I followed a server rendering example, then met this issue. Just relate them to help other people. https://github.com/rackt/redux-router/pull/95/files#diff-2762483ac89ccfaf73745a0c7698af36R54
The current server-rendering example should clarify what history function to use.
https://github.com/acdlite/redux-router/blob/master/examples/server-rendering/server.js#L11
I am using redux-router with isomorphic-fetch server side and ran across an issue if you do not pass a
createHistory
object intoreduxReactRouter({ routes: routes })
in a server.js file in beta4.This is the error thrown within history:
Before beta4 passing the
createHistory
property was optional fromredux-router/server
andcreateLocation
from the requested url just worked. The workaround that I am using is to just callreduxReactRouter({ routes: routes, createHistory: createHistory })
when composing the server store. Note that you can't usecreateBrowserHistory
as it requires a DOM.Might be nice to auto create a default history object on the server if one does not exist. Another option would be to pass in the location instead of just the url...
Instead of this:
You would use this (this is how react-router expects the location in their
match
method):