Comment

Comment by ZephyrBlu

Is the main draw of this performance? I gotta say, I think it's a lot more confusing than React hooks.

I actually like how useEffect has an explicit dependency array because you know when it will be triggered. Signal effects are implicit, and if you don't want it to trigger you have to use .peek(). I think I prefer React's explicit accessing of previous state to peeking when needed.

Why can you destroy effects? That seems like a recipe for disaster. Again, I like how hooks are permanent top-level calls. You know they always run.

When are effects executed? React makes it explicit that they are executed after the render.

What is the purpose of batching other than performance? Are there any possible negative effects of making multiple signal updates without batching?

Writing this has made me a realize I really like the explicitness of React's model.

parent ZephyrBlu 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton