{"action":"created","issue":{"url":"https://api.github.com/repos/gaearon/react-elmish-example/issues/1","labels_url":"https://api.github.com/repos/gaearon/react-elmish-example/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/gaearon/react-elmish-example/issues/1/comments","events_url":"https://api.github.com/repos/gaearon/react-elmish-example/issues/1/events","html_url":"https://github.com/gaearon/react-elmish-example/issues/1","id":111702310,"number":1,"title":"How would you pass actions up to the parent?","user":{"login":"ccorcos","id":1794527,"avatar_url":"https://avatars.githubusercontent.com/u/1794527?v=3","gravatar_id":"","url":"https://api.github.com/users/ccorcos","html_url":"https://github.com/ccorcos","followers_url":"https://api.github.com/users/ccorcos/followers","following_url":"https://api.github.com/users/ccorcos/following{/other_user}","gists_url":"https://api.github.com/users/ccorcos/gists{/gist_id}","starred_url":"https://api.github.com/users/ccorcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccorcos/subscriptions","organizations_url":"https://api.github.com/users/ccorcos/orgs","repos_url":"https://api.github.com/users/ccorcos/repos","events_url":"https://api.github.com/users/ccorcos/events{/privacy}","received_events_url":"https://api.github.com/users/ccorcos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-15T20:37:02Z","updated_at":"2015-10-15T23:51:11Z","closed_at":null,"body":"First off, very cool example.\r\n\r\nI'm playing around with this pattern on a help form. The form has its typical onChange events that update the state, etc. But what happens when the form is submitted? How do I get that information up to the parent? \r\n\r\nRight now I'm having to parse through all the action messages and delegate them to the project updater. This is pretty tedious.\r\n\r\n```jsx\r\nlet Help = {\r\n  view: function({state, dispatch}) {\r\n    return (\r\n      state.success ? \r\n        <HelpFormSuccess state={state} dispatch={dispatch}/> : \r\n        <HelpForm state={state} dispatch={dispatch}/>\r\n    )\r\n  },\r\n  update: function(state=initialState, action) {\r\n    switch (action.type) {\r\n      case ON_ERROR:\r\n        //...\r\n      case VALIDATE_AND_SUBMIT:\r\n        //...\r\n      case ON_CHANGE:\r\n        return HelpForm.update(state, action)\r\n      default:\r\n        return state\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nIt would be cool it there was a way to indicate whether an action is meant to be dispatched to itself, or up to the parent. How does Elm deal with this? I understand this is just a toy example, but its really cool and I think it would be really power if its done right."},"comment":{"url":"https://api.github.com/repos/gaearon/react-elmish-example/issues/comments/148554834","html_url":"https://github.com/gaearon/react-elmish-example/issues/1#issuecomment-148554834","issue_url":"https://api.github.com/repos/gaearon/react-elmish-example/issues/1","id":148554834,"user":{"login":"ccorcos","id":1794527,"avatar_url":"https://avatars.githubusercontent.com/u/1794527?v=3","gravatar_id":"","url":"https://api.github.com/users/ccorcos","html_url":"https://github.com/ccorcos","followers_url":"https://api.github.com/users/ccorcos/followers","following_url":"https://api.github.com/users/ccorcos/following{/other_user}","gists_url":"https://api.github.com/users/ccorcos/gists{/gist_id}","starred_url":"https://api.github.com/users/ccorcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccorcos/subscriptions","organizations_url":"https://api.github.com/users/ccorcos/orgs","repos_url":"https://api.github.com/users/ccorcos/repos","events_url":"https://api.github.com/users/ccorcos/events{/privacy}","received_events_url":"https://api.github.com/users/ccorcos/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T23:51:11Z","updated_at":"2015-10-15T23:51:11Z","body":"To your recommendation, I've been looking into Clojurescript all day today. Seems like Cursors are the way to go for passing state down to children. \r\n\r\nhttps://github.com/facebook/immutable-js/tree/master/contrib/cursor"}}