4 ms·
You can do that, but you will need to find a way to re-render the components which use that service, after something changed.
by xatxat 8y ago
You can do that, but you will need to find a way to re-render the components which use that service, after something changed.
- k__ 8y agoI 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.
- ojosilva 8y agoI 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.
- remost 8y agoJust do it the React way and re-render everything by calling ReactDOM.render() again. In most cases that is fast enough.