|
|
|
|
|
by GormanFletcher
1775 days ago
|
|
> Just curious, but in your opinion, how does the composition API improve on React hooks? I'm a fan of how Vue's composition API executes exactly once during a component lifetime (during `setup()`), whereas React hooks get set up again on every render. I find it I find Vue's approach easier to mentally model, and thus easier to write correct code (especially when doing something complicated where state changes / effect executions trigger each other). Since `setup()` is only run once, I can also do things like store non-reactive state in closure variables without wrapping those variables in hooks. |
|
It is kinda nice making reactive state really explicit like that; I like Svelte's approach for similar reasons.