1- /**
2- * This action type will be dispatched when your history
3- * receives a location change.
4- */
5- export const LOCATION_CHANGE = '@@router/LOCATION_CHANGE'
6-
7- const initialState = {
8- locationBeforeTransitions : null
9- }
1+ import { LOCATION_CHANGE } from './reducer'
102
113const defaultSelectLocationState = state => state . routing
124
13- /**
14- * This reducer will update the state with the most recent location history
15- * has transitioned to. This may not be in sync with the router, particularly
16- * if you have asynchronously-loaded routes, so reading from and relying on
17- * this state it is discouraged.
18- */
19- export function routerReducer ( state = initialState , { type, locationBeforeTransitions } ) {
20- if ( type === LOCATION_CHANGE ) {
21- return { ...state , locationBeforeTransitions }
22- }
23-
24- return state
25- }
26-
275/**
286 * This function synchronizes your history state with the Redux store.
297 * Location changes flow from history to the store. An enhanced history is
@@ -36,7 +14,7 @@ export function routerReducer(state = initialState, { type, locationBeforeTransi
3614 * event, the router will be updated appropriately and can transition to the
3715 * correct router state.
3816 */
39- export function syncHistoryWithStore ( history , store , {
17+ export default function syncHistoryWithStore ( history , store , {
4018 selectLocationState = defaultSelectLocationState ,
4119 adjustUrlOnReplay = true
4220} = { } ) {
0 commit comments