Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm guessing hooks, even react devs are not sure about the fake functional programming nonsense.


Vue3's composition api is literally a better version of hooks. Which actually answers vue2's pain points. And is strictly better than mixins.

In fact, many Vue projects are using composition Api in Vue2 via a plugin because it is so good.


Just curious, but in your opinion, how does the composition API improve on React hooks?

I used Vue 2 for some projects a year or two ago, and recently have been comparing React hooks & Vue's composition API. Composition is definitely better than mixins, but as a new React user, hooks are feeling more intuitive right off the bat. With Vue 3, I feel like I have to decide for every component whether to stick with the options API or use the setup method, or end up with some awkward in-between.

I was always a big fan of Vue though; I'd appreciate any insight you can give on the Vue 3 additions.


> 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.


I think this puts it in perspective more; if I understand what you're saying correctly, then setup essentially gives you more fine-grained control over Vue's reactivity system, as opposed to just doing it all for you when a component is created. Which allows you to more easily pull out & consolidate reusable logic as needed.

It is kinda nice making reactive state really explicit like that; I like Svelte's approach for similar reasons.


There are many points. The main point for me is dependency tracking.

React hooks require manual dependency tracking and mistakes in this can lead hard to identify bugs

Vue has automatic dependency tracking, so that entire class of issues do not occur.


THIS. People focus so much on templates vs jsx and most forget this is the biggest difference, and a very important one. I think people discarding Vue because they don't like templates just don't understand this difference.


Hooks today are like CSS utility classes a few years ago.

"It's not semantic"

They will stay or they will go but I think they are useful more than they are not but I don't think its the final form we'll all adopt.


Hooks are way easier to use than everything that came before them.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: