Upgrading redux 0.12 to 1
Breaking0.12.0 → 1.0.1Breaking18New4Changed3Fixed8Other4
BreakingUpgrade verdict
16 breaking changes.
In plain terms
- You must now wrap multiple reducers with combineReducers before passing them to createStore.
- Middleware is now applied by wrapping createStore with applyMiddleware rather than passing it to createStore.
- Async action creators that return functions now require adding redux-thunk and passing it to applyMiddleware.
- The concept previously called a stateless store is now called a reducer.
Must act Top 3 of 16 that need code or config changes
Drops invariant.
Installs 0 packages in all (was 3).
No longer installs js-tokens, loose-envify.
What you must change
Breaking16
createStore no longer implicitly combines reducers; use combineReducers explicitly.
createStorecombineReducerscreateStore no longer accepts middleware; use applyMiddleware instead.
createStoreapplyMiddlewareThe thunk middleware is no longer included by default.
redux-thunkapplyMiddlewareRenames "Stateless Stores" to reducers.
Renames the "Redux instance" to "The Store".
Removes the dispatcher completely.
Renames composeStores to composeReducers.
composeStorescomposeReducersRemoves createDispatcher.
createDispatcherRenames createRedux to createStore.
createReduxcreateStoreThrows an error if dispatch is attempted while a reducer is executing; dispatching from lifecycle hooks still works.
dispatchMoves React-specific code to the separate react-redux package, versioned separately.
ProviderprovideConnectorconnectAll middleware now receives { getState, dispatch } as its first parameter.
getStatedispatchcombineReducers now throws if a reducer returns undefined state.
combineReducers@@INIT@@redux/INITProvider now accepts a store prop instead of redux.
ProviderstorereduxChanges createStore signature to accept reducer, initialState and middlewares.
createStoreChanges the smart middleware signature to accept an object instead of a single getState function.
getStatedispatch