top | item 16921476

(no title)

xatxat | 7 years 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.

discuss

order

k__|7 years ago

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.

ojosilva|7 years ago

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.

remost|7 years ago

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