{"action":"created","issue":{"url":"https://api.github.com/repos/acdlite/redux-actions/issues/54","labels_url":"https://api.github.com/repos/acdlite/redux-actions/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/acdlite/redux-actions/issues/54/comments","events_url":"https://api.github.com/repos/acdlite/redux-actions/issues/54/events","html_url":"https://github.com/acdlite/redux-actions/issues/54","id":125032461,"number":54,"title":"How to use combineReducers to add multiple reducers that use the same action type?","user":{"login":"pixeldrew","id":129363,"avatar_url":"https://avatars.githubusercontent.com/u/129363?v=3","gravatar_id":"","url":"https://api.github.com/users/pixeldrew","html_url":"https://github.com/pixeldrew","followers_url":"https://api.github.com/users/pixeldrew/followers","following_url":"https://api.github.com/users/pixeldrew/following{/other_user}","gists_url":"https://api.github.com/users/pixeldrew/gists{/gist_id}","starred_url":"https://api.github.com/users/pixeldrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixeldrew/subscriptions","organizations_url":"https://api.github.com/users/pixeldrew/orgs","repos_url":"https://api.github.com/users/pixeldrew/repos","events_url":"https://api.github.com/users/pixeldrew/events{/privacy}","received_events_url":"https://api.github.com/users/pixeldrew/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-01-05T19:21:55Z","updated_at":"2016-01-06T00:16:44Z","closed_at":"2016-01-06T00:16:01Z","body":"I'm using combineReducers and i'm wondering how I can use handleActions to have two different store keys be updated by the one action type. My requirement is that the one action type be used to update different keys inside the store, for example I have a transactions array which must add a new transaction then I must update the balance of the account the transaction relates to.\r\n\r\nThis doesn't seem to work, or am I doing this wrong?\r\n```js\r\nimport { combineReducers } from 'redux';\r\nimport { handleActions } from 'redux-actions';\r\n\r\nconst ADD_TRANSACTION = 'ADD_TRANSACTION';\r\nlet defaultTransactionsState = [];\r\nlet defaultAccountsState = [];\r\n\r\n// add transaction to transactions state\r\nlet transactions = handleActions({\r\n  [ADD_TRANSACTION]: (state, action) => ([action.payload, state...])\r\n}, defaultTransactionsState);\r\n\r\nlet accounts = handleActions({\r\n  [ADD_TRANSACTION]: (state, action) => {\r\n    // update the balance of account based on transaction being added\r\n    let payload = action.payload;\r\n    let accountToEdit = state.find((account) =>  account.id === payload.accountId);\r\n    let newBalance = accountToEdit.balance + (payload.inAmount - payload.outAmount);\r\n\r\n    return state.map(account =>\r\n      account.id === accountToEdit.id\r\n        ? {...account, balance: newBalance}\r\n        : account\r\n    );\r\n  }\r\n}, defaultAccountsState);\r\n\r\ncombineReducers({\r\n  transactions,\r\n  accounts\r\n});\r\n```"},"comment":{"url":"https://api.github.com/repos/acdlite/redux-actions/issues/comments/169176107","html_url":"https://github.com/acdlite/redux-actions/issues/54#issuecomment-169176107","issue_url":"https://api.github.com/repos/acdlite/redux-actions/issues/54","id":169176107,"user":{"login":"pixeldrew","id":129363,"avatar_url":"https://avatars.githubusercontent.com/u/129363?v=3","gravatar_id":"","url":"https://api.github.com/users/pixeldrew","html_url":"https://github.com/pixeldrew","followers_url":"https://api.github.com/users/pixeldrew/followers","following_url":"https://api.github.com/users/pixeldrew/following{/other_user}","gists_url":"https://api.github.com/users/pixeldrew/gists{/gist_id}","starred_url":"https://api.github.com/users/pixeldrew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pixeldrew/subscriptions","organizations_url":"https://api.github.com/users/pixeldrew/orgs","repos_url":"https://api.github.com/users/pixeldrew/repos","events_url":"https://api.github.com/users/pixeldrew/events{/privacy}","received_events_url":"https://api.github.com/users/pixeldrew/received_events","type":"User","site_admin":false},"created_at":"2016-01-06T00:16:44Z","updated_at":"2016-01-06T00:16:44Z","body":"Side note, would love to get a CDN/UMD version of this library to throw up jsfiddles or jsbin's"}}