neuronetio/deep-state-observer

React js usage

T4SUYA opened this issue · 1 comments

Can you provide a example in React?, this lib can work in a way that replaces React SetState?, triggering re-render etc.

Thank you for the attention.

This library is not indented for that.
This library does not bite into the mechanisms of operation of popular frameworks, because it was created for a slightly different purpose.
If you have global state as a tree in the deep state observer, each component should have a local state that should update the specific component when it is changed by the responsive update mechanisms (I'm not up to date with responsiveness so can't help with that).
As in the svelte example - when you update a local component variable - the component will render again - but you need to listen to the global state via subscribe and then update the state of the local component in that particular component.