3 ms·
Oh damn. I've been working on a project using very similar tricks for the passed ~3 years. I'm assuming state is a proxy and you're using the single threaded
by seph-reed 5y ago
Oh damn. I've been working on a project using very similar tricks for the passed ~3 years.
I'm assuming state is a proxy and you're using the single threaded nature of JS to make render functions dependent on accessed variables?
- dumindaxsb 5y agoExactly, and state changes are batched behind requestAnimationFrame :) Also, there's .react(new_state), which is synchronous. If one prefer not to use Proxies (old browsers, etc), it can be disabled via .react( state, { ..., watched: false } ) and then can call just .react() manually after state changes. Which is also batched(async).
- seph-reed 5y agoWoah. Congrats. This is pretty much exactly the setup I've been using for a few years now. It is -- without a doubt -- vastly better than any other frameworks approach I've ever used.
- dumindaxsb 5y agoSame technique is used for .$ reference holder. Proxies are awesome! :)