Hacker News new | past | comments | ask | show | jobs | submit login

You can do that, but you will need to find a way to re-render the components which use that service, after something changed.



I think this works well for Angular, because it's based on observables. Rendering is just a function from state->ui. If they build their state-container on observables too, the re-render will follow implicitly by subscribing to it.


I think that's what mobx is all about. I create a simple Javascript class called WhateverStore and make it observable. Then all the UI components are observer of an instantiated WhateverStore and that's about it.


Just do it the React way and re-render everything by calling ReactDOM.render() again. In most cases that is fast enough.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: