{"action":"created","issue":{"url":"https://api.github.com/repos/reactjs/react-router-redux/issues/301","repository_url":"https://api.github.com/repos/reactjs/react-router-redux","labels_url":"https://api.github.com/repos/reactjs/react-router-redux/issues/301/labels{/name}","comments_url":"https://api.github.com/repos/reactjs/react-router-redux/issues/301/comments","events_url":"https://api.github.com/repos/reactjs/react-router-redux/issues/301/events","html_url":"https://github.com/reactjs/react-router-redux/issues/301","id":135899774,"number":301,"title":"immutablejs instructions","user":{"login":"jokeyrhyme","id":479816,"avatar_url":"https://avatars.githubusercontent.com/u/479816?v=3","gravatar_id":"","url":"https://api.github.com/users/jokeyrhyme","html_url":"https://github.com/jokeyrhyme","followers_url":"https://api.github.com/users/jokeyrhyme/followers","following_url":"https://api.github.com/users/jokeyrhyme/following{/other_user}","gists_url":"https://api.github.com/users/jokeyrhyme/gists{/gist_id}","starred_url":"https://api.github.com/users/jokeyrhyme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jokeyrhyme/subscriptions","organizations_url":"https://api.github.com/users/jokeyrhyme/orgs","repos_url":"https://api.github.com/users/jokeyrhyme/repos","events_url":"https://api.github.com/users/jokeyrhyme/events{/privacy}","received_events_url":"https://api.github.com/users/jokeyrhyme/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2016-02-23T23:31:03Z","updated_at":"2016-03-01T10:28:15Z","closed_at":"2016-02-24T16:47:17Z","body":"I'm working from https://github.com/davezuko/react-redux-starter-kit if that helps explain my context.\r\n\r\nThis is the custom reducer I needed:\r\n\r\n```js\r\nimport Immutable from 'immutable';\r\nimport {\r\n    LOCATION_CHANGE\r\n} from 'react-router-redux';\r\n\r\nlet initialState;\r\n\r\ninitialState = Immutable.fromJS({\r\n    locationBeforeTransitions: undefined\r\n});\r\n\r\nexport default (state = initialState, action) => {\r\n    if (action.type === LOCATION_CHANGE) {\r\n        return state.merge({\r\n            locationBeforeTransitions: action.payload\r\n        });\r\n    }\r\n\r\n    return state;\r\n};\r\n```\r\n\r\nI had to read the following to figure this out:\r\n\r\n- https://github.com/reactjs/react-router-redux/issues/298\r\n\r\n- https://github.com/reactjs/react-router-redux/blob/v4.0.0/src/reducer.js\r\n\r\nAlso, I had to set up a custom \"selectLocationState\" selector to get immutable store values to be fed to Router correctly:\r\n\r\n```js\r\nimport createHistory from 'history/lib/createHashHistory';\r\n// or: import createHistory from 'history/lib/createBrowserHistory';\r\nimport { useRouterHistory } from 'react-router';\r\nimport { syncHistoryWithStore } from 'react-router-redux';\r\n\r\nconst browserHistory = useRouterHistory(createHistory)({\r\n  basename: __BASENAME__\r\n});\r\nconst history = syncHistoryWithStore(browserHistory, store, {\r\n  selectLocationState: (state) => state.get('router').toJS()\r\n});\r\n\r\n// pass above \"history\" to Router component as a prop\r\n```\r\n\r\nThat's mentioned here:\r\n\r\n- https://github.com/reactjs/react-router-redux#what-if-i-use-immutablejs-with-my-redux-store"},"comment":{"url":"https://api.github.com/repos/reactjs/react-router-redux/issues/comments/190652764","html_url":"https://github.com/reactjs/react-router-redux/issues/301#issuecomment-190652764","issue_url":"https://api.github.com/repos/reactjs/react-router-redux/issues/301","id":190652764,"user":{"login":"jamesisaac","id":1068177,"avatar_url":"https://avatars.githubusercontent.com/u/1068177?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesisaac","html_url":"https://github.com/jamesisaac","followers_url":"https://api.github.com/users/jamesisaac/followers","following_url":"https://api.github.com/users/jamesisaac/following{/other_user}","gists_url":"https://api.github.com/users/jamesisaac/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesisaac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesisaac/subscriptions","organizations_url":"https://api.github.com/users/jamesisaac/orgs","repos_url":"https://api.github.com/users/jamesisaac/repos","events_url":"https://api.github.com/users/jamesisaac/events{/privacy}","received_events_url":"https://api.github.com/users/jamesisaac/received_events","type":"User","site_admin":false},"created_at":"2016-03-01T10:28:15Z","updated_at":"2016-03-01T10:28:15Z","body":"My bad, sorry - came across this project on the day of posting and wasn't looking at the dates, so didn't realise the current API was this recent."}}