Skip to content

v5.0.0

Compare
Choose a tag to compare
@supasate supasate released this 03 Nov 05:08
· 239 commits to master since this release

Breaking Change

Align public API with react-router-redux and allow various integrations (redux-loop, rematch, etc.) (@sgal in #150)

  1. In your reducer file, instead of exporting a root reducer, we need to export a function accepting history and returning a root reducer with a router key that uses connectRouter(history). Note: The key MUST be router.
// reducers.js

import { combineReducers } from 'redux'
import { connectRouter } from 'connected-react-router'

export default (history) => combineReducers({
  router: connectRouter(history),
  ... // rest of your reducers
})
  1. In store configuration,
// configureStore.js
import { createBrowserHistory } from 'history'
import { applyMiddleware, compose, createStore } from 'redux'
import { routerMiddleware } from 'connected-react-router'
import createRootReducer from './reducers'

const history = createBrowserHistory()
const store = createStore(
  createRootReducer(history), // root reducer with router state
  initialState,
  compose(
    applyMiddleware(
      routerMiddleware(history), // for dispatching history actions
      // ... other middlewares ...
    ),
  ),
)

Enhancement

  • Expose router reducer with customized name to make it work with other libraries (redux-loop, rematch, etc) (@sgal in #150)
  • Add TypeScript definitions for immutable (@thomschke in #145)
  • Add TypeScript definitions for seamless-immutable (@Brettm12345 in #157)
  • Use string literal type for CALL_HISTORY_METHOD (@maxhawkins in #147)
  • Move redux-seamless-immutable to devDependencies (@n3tr in #167)

Bug fix

  • Fix redux state is created on every action (@sgal in #150)
  • Fix TypeScript error on React 16 (@thomschke in #145)
  • Fix connectRouter TypeScript definition (@supasate in #156)
  • Update RouterAction types to be strongly typed on the exact strings (@colbydehart in #149)
  • Fix FAQ links (@durasj in #162 and #163)