4 ms·
That looks pretty similar but I like the use of classes in react-class-model to encourage keeping logic out of components. It's not shown in the readme but usin
by Rohansi 2y ago
That looks pretty similar but I like the use of classes in react-class-model to encourage keeping logic out of components. It's not shown in the readme but using context is optional - you can similarly achieve global state by storing it in a variable and then using `watchCounterModel` (the third return value from `defineModel`) to subscribe to updates on it. Both hooks also return proxies to re-render only when the referenced fields change.