{"action":"created","issue":{"url":"https://api.github.com/repos/Raynos/mercury/issues/191","labels_url":"https://api.github.com/repos/Raynos/mercury/issues/191/labels{/name}","comments_url":"https://api.github.com/repos/Raynos/mercury/issues/191/comments","events_url":"https://api.github.com/repos/Raynos/mercury/issues/191/events","html_url":"https://github.com/Raynos/mercury/issues/191","id":111996630,"number":191,"title":"Why static render methods?","user":{"login":"shoover","id":20804,"avatar_url":"https://avatars.githubusercontent.com/u/20804?v=3","gravatar_id":"","url":"https://api.github.com/users/shoover","html_url":"https://github.com/shoover","followers_url":"https://api.github.com/users/shoover/followers","following_url":"https://api.github.com/users/shoover/following{/other_user}","gists_url":"https://api.github.com/users/shoover/gists{/gist_id}","starred_url":"https://api.github.com/users/shoover/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shoover/subscriptions","organizations_url":"https://api.github.com/users/shoover/orgs","repos_url":"https://api.github.com/users/shoover/repos","events_url":"https://api.github.com/users/shoover/events{/privacy}","received_events_url":"https://api.github.com/users/shoover/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-18T02:26:58Z","updated_at":"2015-11-11T01:15:45Z","closed_at":null,"body":"Just curious why mercury component render methods are static since naively it would be convenient for a parent component to call foo.render() as an instance method. Is that mainly to enforce separation from the state object and discourage mutating local state?\r\n\r\nThanks very much for the excellent docs and examples. Mercury is an enlightening project."},"comment":{"url":"https://api.github.com/repos/Raynos/mercury/issues/comments/155622232","html_url":"https://github.com/Raynos/mercury/issues/191#issuecomment-155622232","issue_url":"https://api.github.com/repos/Raynos/mercury/issues/191","id":155622232,"user":{"login":"eightyeight","id":904269,"avatar_url":"https://avatars.githubusercontent.com/u/904269?v=3","gravatar_id":"","url":"https://api.github.com/users/eightyeight","html_url":"https://github.com/eightyeight","followers_url":"https://api.github.com/users/eightyeight/followers","following_url":"https://api.github.com/users/eightyeight/following{/other_user}","gists_url":"https://api.github.com/users/eightyeight/gists{/gist_id}","starred_url":"https://api.github.com/users/eightyeight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eightyeight/subscriptions","organizations_url":"https://api.github.com/users/eightyeight/orgs","repos_url":"https://api.github.com/users/eightyeight/repos","events_url":"https://api.github.com/users/eightyeight/events{/privacy}","received_events_url":"https://api.github.com/users/eightyeight/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T01:15:45Z","updated_at":"2015-11-11T01:15:45Z","body":"You can definitely do that. I advocate separating render functions completely into their own files because\r\n\r\n 1. Hot reloading is easier to do\r\n 2. It makes it more difficult for the view to update model state in unexpected ways (the only sanctioned way is by binding channels to the DOM) There is always the possibility for local state in renderers, what you want is for the model to control access to itself via channels\r\n 3. Ideologically, model and view should be separate. There are many ways one might want to render a boolean state; so instead of duplicating the state in several components (tickbox component, switch component), separate state and renderer (boolean state + tickbox renderer or switch renderer)\r\n\r\n2 and 3 are just my opinion. Raynos does seem to lean more componentwards in some of the examples, for example how most render methods are attached to an object, not completely free."}}