4 ms·
The funny thing is that with reactivity like Vue/MobX you don't actually _need_ to make setInterval (or any other function) declarative - the change detection s
by inglor 8y ago
The funny thing is that with reactivity like Vue/MobX you don't actually _need_ to make setInterval (or any other function) declarative - the change detection system abstracts all this from you and you have one less concern to care about everywhere rather than having to do this manually in terms of hooks for every component.
Everything is just JavaScript (well... TypeScript) and the abstraction is solid enough none of this is a concern you have to deal with.
(I enjoyed reading the article - the writing was solid :))
- ryansolid 8y agoThat's true. In one sense perhaps hooks are trying to hard to model a different paradigm to what react runs on. But its interesting to see this approach as it applies this pattern to other change detection mechanisms not typically associated with fine grained change detection. Ive seen libraries apply hooks to like LitHTML in webcomponents. Its the first time Ive seen the potential for a universal API here. How sweet would it be if library writers could target hooks instead of a specific framework?
- underwater 8y agoCan you share an example? I'm not familiar with how you'd define a component-specific interval.