{"action":"created","issue":{"url":"https://api.github.com/repos/kadirahq/react-komposer/issues/123","repository_url":"https://api.github.com/repos/kadirahq/react-komposer","labels_url":"https://api.github.com/repos/kadirahq/react-komposer/issues/123/labels{/name}","comments_url":"https://api.github.com/repos/kadirahq/react-komposer/issues/123/comments","events_url":"https://api.github.com/repos/kadirahq/react-komposer/issues/123/events","html_url":"https://github.com/kadirahq/react-komposer/issues/123","id":179372586,"number":123,"title":"React Komposer 2.x","user":{"login":"arunoda","id":50838,"avatar_url":"https://avatars.githubusercontent.com/u/50838?v=3","gravatar_id":"","url":"https://api.github.com/users/arunoda","html_url":"https://github.com/arunoda","followers_url":"https://api.github.com/users/arunoda/followers","following_url":"https://api.github.com/users/arunoda/following{/other_user}","gists_url":"https://api.github.com/users/arunoda/gists{/gist_id}","starred_url":"https://api.github.com/users/arunoda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunoda/subscriptions","organizations_url":"https://api.github.com/users/arunoda/orgs","repos_url":"https://api.github.com/users/arunoda/repos","events_url":"https://api.github.com/users/arunoda/events{/privacy}","received_events_url":"https://api.github.com/users/arunoda/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-09-27T00:48:47Z","updated_at":"2016-10-19T16:25:22Z","closed_at":null,"body":"We've been pretty busy with some internal apps these days. Sorry for not updating.\r\nWhen we are building it and looking at some of these issues, I think we need to re-think about the API.\r\n\r\nHere's what we are looking to have in 2.x (Which will be out pretty soon).\r\n\r\n```js\r\nimport { makeComposer, merge } from 'react-komposer';\r\n// Additional dataLoader generators are located in a different NPM package.\r\n// These goes into the same repo. But multiple NPM modules. That's to have their own NPM modules for each of these.\r\nimport getPromiseLoader from 'react-komposer-promise';\r\nimport getRxLoader from 'react-komposer-rx';\r\n\r\n// We need to this once in an app.\r\n// With this, we could create our own base compose utility with our own options.\r\n// Additionally, this'll allow us to use react-komposer under React Native since\r\n// we don't have any loading and error components.\r\nconst compose = makeComposer({\r\n  loading: () => (<div>Loading..</div>),\r\n  error: (error) => alert(error.message),\r\n  pure: true,\r\n  propsToWatch: [], // Now dataLoader is re-run only when one of the props mentioned is changed. In this case, it only runs once.\r\n  context: { // This is how we pass addition stuff to the dataLoader.\r\n    reduxStore: {}\r\n  }\r\n});\r\n\r\n// Now there's two callbacks onData and onError.\r\n// That's because, we don't usually use onError.\r\n// We may handle it via our own component rather using something global.\r\n// We use the onError specially in prototyping the app.\r\nconst dataLoader = (props, onData, onError) => {\r\n  // Fetch from the data.\r\n  // We can access the context via this.\r\n  //   For an example, we can get the reduxStore with `this.reduxStore`\r\n  return aa.subscribe();\r\n};\r\n\r\nconst now = Rx.Observable.interval(1000)\r\n  .map(() => new Date().toString());\r\n\r\n// Now composeAll is renamed into merge\r\nconst DataAwareComponent = merge(\r\n  compose(dataLoader, { propsToWatch: ['appId'] }), // We could alter options like this.\r\n  compose(getPromiseLoader(Promise.resolve(100), 'promiseData')),\r\n  compose(getRxLoader(now, 'date')),\r\n)(<Component/>);\r\n```"},"comment":{"url":"https://api.github.com/repos/kadirahq/react-komposer/issues/comments/254865537","html_url":"https://github.com/kadirahq/react-komposer/issues/123#issuecomment-254865537","issue_url":"https://api.github.com/repos/kadirahq/react-komposer/issues/123","id":254865537,"user":{"login":"ElegantSudo","id":19272022,"avatar_url":"https://avatars.githubusercontent.com/u/19272022?v=3","gravatar_id":"","url":"https://api.github.com/users/ElegantSudo","html_url":"https://github.com/ElegantSudo","followers_url":"https://api.github.com/users/ElegantSudo/followers","following_url":"https://api.github.com/users/ElegantSudo/following{/other_user}","gists_url":"https://api.github.com/users/ElegantSudo/gists{/gist_id}","starred_url":"https://api.github.com/users/ElegantSudo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElegantSudo/subscriptions","organizations_url":"https://api.github.com/users/ElegantSudo/orgs","repos_url":"https://api.github.com/users/ElegantSudo/repos","events_url":"https://api.github.com/users/ElegantSudo/events{/privacy}","received_events_url":"https://api.github.com/users/ElegantSudo/received_events","type":"User","site_admin":false},"created_at":"2016-10-19T16:25:22Z","updated_at":"2016-10-19T16:25:22Z","body":"Hm, I think the old pattern/usage was simpler."}}
{"actor":{"display_login":"ElegantSudo"}}