Releases: colinmeinke/universal-redux-router
Releases · colinmeinke/universal-redux-router
v2.2.0
v2.1.0
v2.0.0
<a name"2.0.0">
2.0.0 (2016-02-12)
Features
- core: allow async action creators (038fde10)
Breaking Changes
- getState now returns a promise
Before:
const state = getState( url, routes, reducer );
const store = createStore( reducer, state, middleware );
After:
getState( url, routes, reducer ).then( state => {
const store = createStore( reducer, state, middleware );
})
(038fde10)
v1.2.0
v1.1.1
v1.1.0
v1.0.1
v1.0.0
<a name"1.0.0">
1.0.0 (2016-02-05)
Features
- core: allow attaching action creators to routes, and more... (7ad5ffa9)
Breaking Changes
structure of routes has changed from a function to an array.
Before:
const routes = url => {
const path = url.split( '?' )[ 0 ];
const query = qs.parse( qs.extract( url ));
switch ( path ) {
case '/about':
return <About />;
case '/hello':
return <Hello name={ query.name } />;
case '/':
return <Home />;
default:
return <NotFound />;
}
};
After:
const routes = [
[ 'about', <About /> ],
[ 'hello', { name: updateName }, <Hello /> ],
[ '/', <Home /> ],
[ '*', <NotFound /> ],
];
This now allows dynamic routes and attaching action creators to routes to handle params.
Link component now takes to prop, not url prop.
Before:
<Link url="/">Home</Link>
After:
<Link to="/">Home</Link>
This now allows Link component to also take a to array:
<Link to={[ 'users', id, 'followers', { page: 2 }]}>Followers</Link>
updateUrl action creator has been removed from the public API in favour of changePageTo.
Before:
dispatch( updateUrl( '/' ))
After:
dispatch( changePageTo( '/' ))
This now allows us to also pass in a to array:
dispatch( changePageTo([ 'users', id, 'followers', { page: 2 }]))
now requires routerMiddleware.
Before: none
After:
const middleware = applyMiddleware( routerMiddleware( routes, { isServer }));
const store = createStore( reducer, state, middleware );
This allows us to batch the action creators we have attached to our routes into one dispatch.
now requires routerReducer instead of Redux combineReducers.
Before:
const reducer = combineReducers({ ...reducers, url: urlReducer });
After:
const reducer = routerReducer( reducers );
Notice how urlReducer is no longer needed.
now handles popstate by default.
No need to add listener and dispatch updateUrl manually.
Before:
window.addEventListener( 'popstate', () => {
const { hash, pathname, search } = window.location;
const url = pathname + search + hash;
store.dispatch( updateUrl( url ));
});
After: none
(7ad5ffa9)