{"action":"opened","issue":{"url":"https://api.github.com/repos/jamesplease/react-composer/issues/43","repository_url":"https://api.github.com/repos/jamesplease/react-composer","labels_url":"https://api.github.com/repos/jamesplease/react-composer/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/jamesplease/react-composer/issues/43/comments","events_url":"https://api.github.com/repos/jamesplease/react-composer/issues/43/events","html_url":"https://github.com/jamesplease/react-composer/issues/43","id":302117943,"number":43,"title":"Poll: breaking API change?","user":{"login":"jamesplease","id":2322305,"avatar_url":"https://avatars3.githubusercontent.com/u/2322305?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesplease","html_url":"https://github.com/jamesplease","followers_url":"https://api.github.com/users/jamesplease/followers","following_url":"https://api.github.com/users/jamesplease/following{/other_user}","gists_url":"https://api.github.com/users/jamesplease/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesplease/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesplease/subscriptions","organizations_url":"https://api.github.com/users/jamesplease/orgs","repos_url":"https://api.github.com/users/jamesplease/repos","events_url":"https://api.github.com/users/jamesplease/events{/privacy}","received_events_url":"https://api.github.com/users/jamesplease/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-04T20:19:19Z","updated_at":"2018-03-04T20:19:19Z","closed_at":null,"author_association":"OWNER","body":"**To cast your vote, please leave a reaction emoji of :+1: or :-1: to this issue!**\r\n\r\n@erikthedeveloper proposed a really good API for Composer over in #39 . The change is this: instead of your component callbacks receiving `results`, they receive `({ results, render })`. You can then specify `render` as the render prop of the component.\r\n\r\nHere is @erikthedeveloper 's example from that PR, showing it in use:\r\n\r\n```jsx\r\n<Composer\r\n  components={[\r\n    // React elements may be passed for simple/basic use cases.\r\n    // Assumes single value produced such as `props.children(producedValue)`\r\n    <Echo value=\"outer\" />,\r\n\r\n    // OR A function may be passed to produce an element.\r\n\r\n    // Utilizing outer results for inner components\r\n    ({ render, results: [outerResult] }) => (\r\n      <Echo value={`${outerResult.value} + middle`} children={render} />\r\n    ),\r\n    \r\n    // Differing render prop signature (multi-arg producers)\r\n    ({ /* results, */ render }) => (\r\n      <DoubleEcho value=\"spaghetti\">\r\n        {(one, two) => render([one, two])}\r\n      </DoubleEcho>\r\n    ),\r\n    \r\n    // Differing render prop names...\r\n    ({ /* results, */ render }) => (\r\n      <EchoRenderProp value=\"spaghetti\" renderProp={render} />\r\n    )\r\n    ]}\r\n  ]}\r\n  children={/* ... */}\r\n/>\r\n```\r\n\r\n### Negatives\r\n\r\n- This is a (pretty big) breaking API change.\r\n\r\n### Positives\r\n\r\n- Reduces API surface area. `renderPropName` and `mapResult` are no longer needed, although you can still use their same functionality\r\n- Provides a good solution to the issue where you would get console warnings for omitting the render prop ( #42 )\r\n- Supports more easily composing render prop components with different render prop names ( #37 )\r\n\r\n---\r\n\r\ntl;dr, it is a flexible, small, and powerful API that is a big breaking change from what we currently have. What do people think? Should it be changed?"}}
{"actor":{"display_login":"jamesplease"}}