{"action":"created","issue":{"url":"https://api.github.com/repos/kadirahq/mantra/issues/78","repository_url":"https://api.github.com/repos/kadirahq/mantra","labels_url":"https://api.github.com/repos/kadirahq/mantra/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/kadirahq/mantra/issues/78/comments","events_url":"https://api.github.com/repos/kadirahq/mantra/issues/78/events","html_url":"https://github.com/kadirahq/mantra/issues/78","id":132861146,"number":78,"title":"Simplified alternative for mantra components/containers","user":{"login":"vonwao","id":377000,"avatar_url":"https://avatars.githubusercontent.com/u/377000?v=3","gravatar_id":"","url":"https://api.github.com/users/vonwao","html_url":"https://github.com/vonwao","followers_url":"https://api.github.com/users/vonwao/followers","following_url":"https://api.github.com/users/vonwao/following{/other_user}","gists_url":"https://api.github.com/users/vonwao/gists{/gist_id}","starred_url":"https://api.github.com/users/vonwao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vonwao/subscriptions","organizations_url":"https://api.github.com/users/vonwao/orgs","repos_url":"https://api.github.com/users/vonwao/repos","events_url":"https://api.github.com/users/vonwao/events{/privacy}","received_events_url":"https://api.github.com/users/vonwao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-11T00:41:23Z","updated_at":"2016-02-11T07:18:18Z","closed_at":null,"body":"I would like a simplified version of Mantra. Something that is less intimidating for a hackers/hobbyist, with less files and less repetition of code. \r\n\r\nI think Mantra currently is perfect for a professional team, because it's very explicit, and all the code separation is needed when working on team, etc.  But for me personally it's too much!\r\n\r\nTwo suggestions: \r\n1. create some utilities: composeWithActions and composeView (or some other name)\r\n2. I would love to put all my (component and container) code into one file.  Currently this breaks the \"mantra guidelines\", but it's easier.\r\n\r\nFor example for newpost.jsx:\r\n\r\n```\r\nimport React from 'react';\r\nimport {composeWithActions} from 'mantra'\r\n\r\nclass NewPost extends React.Component {\r\n  render() {\r\n    const {error} = this.props;\r\n    return (\r\n      <div className=\"new-post\">\r\n      <h2>Add New Post</h2>\r\n    {error ? <p style={{color: 'red'}}>{error}</p> : null}\r\n  <input ref=\"titleRef\" type=\"Text\" placeholder=\"Enter your post title.\" /> <br/>\r\n      <textarea ref=\"contentRef\" placeholder=\"Enter your post content.\" /> <br/>\r\n      <button onClick={this.createPost.bind(this)}>Add New</button>\r\n    </div>\r\n  );\r\n  }\r\n\r\n  createPost() {\r\n    //WE GOT ALL ACTIONS IN PROPS\r\n    const {create} = this.props.actions.posts   \r\n    const {titleRef, contentRef} = this.refs;\r\n    create(titleRef.value, contentRef.value);\r\n  }\r\n}\r\n\r\nconst composer = ({context, clearErrors}, onData) => {\r\n  const {LocalState} = context();\r\n  const error = LocalState.get('SAVING_ERROR');\r\n  onData(null, {error});\r\n  // clearErrors when unmounting the component\r\n  return clearErrors;\r\n};\r\n\r\nexport default composeWithActions(composer, NewPost)\r\n```\r\n\r\nThis way I don't need to worry about useDeps, because all actions will be automatically available in my component.  \r\n\r\nI don't know how other people feel about this, but **for me** this code is cleaner and it's easier to understand what is happening, without hunting different files.\r\n\r\nAlso for a hacker/newbie, all the new terminology and so many imports (useDeps, composeWithTracker, etc.) will be intimidating, and creates more possibilities for errors. "},"comment":{"url":"https://api.github.com/repos/kadirahq/mantra/issues/comments/182744270","html_url":"https://github.com/kadirahq/mantra/issues/78#issuecomment-182744270","issue_url":"https://api.github.com/repos/kadirahq/mantra/issues/78","id":182744270,"user":{"login":"achtan","id":1048212,"avatar_url":"https://avatars.githubusercontent.com/u/1048212?v=3","gravatar_id":"","url":"https://api.github.com/users/achtan","html_url":"https://github.com/achtan","followers_url":"https://api.github.com/users/achtan/followers","following_url":"https://api.github.com/users/achtan/following{/other_user}","gists_url":"https://api.github.com/users/achtan/gists{/gist_id}","starred_url":"https://api.github.com/users/achtan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/achtan/subscriptions","organizations_url":"https://api.github.com/users/achtan/orgs","repos_url":"https://api.github.com/users/achtan/repos","events_url":"https://api.github.com/users/achtan/events{/privacy}","received_events_url":"https://api.github.com/users/achtan/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T07:18:18Z","updated_at":"2016-02-11T07:18:18Z","body":"I kinda agree with you. Sometimes for pragmatic reasons is your approach better.\r\n\r\nbtw: now you can use `export default composeAll(compose(composer),  useDeps())(NewPost);` this way all actions will be available from `actions()` function"}}