r/javascript • • Jun 08 '21

The Plan for React 18

https://reactjs.org/blog/2021/06/08/the-plan-for-react-18.html
230 Upvotes

118 comments sorted by

View all comments

Show parent comments

11

u/ejfrodo Jun 08 '21 edited Jun 08 '21

I guess you haven't really tried to use Vue 3 :)

Vue 3 is backwards-compatible and the new composition API is entirely optional, you can keep using the old syntax if you'd like while getting a solid performance boost.

I really like the approach they've taken with Vue 3. You can use the more powerful code re-use and composition tools if you want and you get an experience more similar to React hooks using the composition API, but if you want the more simple Vue approach that many ppl came to like Vue for that's still available as well.

1

u/[deleted] Jun 08 '21

U right actually i havent i just tried composition api with vue2 project and for smaller project i prefer simplicity of the “old” way

3

u/DrexanRailex Jun 09 '21

The composition API scales better. If you had ever had to reuse a data/method/lifecycle/watch combination of any kind, you know it's not exactly simple to do with the options API. The composition API allows you to extract the logic into a single function you can call in any component.

1

u/[deleted] Jun 09 '21

Arent that’s what mixins for ?

4

u/[deleted] Jun 09 '21

Afaik mixins can lead to name collisions, which in big projects with many developers can become an issue.

Using the composition api your code just won't run if you redeclare anything, and it's easier for s linter to catch up these things.

That's why they say it scales better.

On a small project, or when working alone, I agree mixins are enough

1

u/McGynecological Jun 10 '21

but if you want the more simple Vue approach that many ppl came to like Vue for that's still available as well.

Yeah, but for how long? Now there's two APIs to learn, and you can just bet composition will win out. When the original RFC was made, Evan You wanted to completely replace the options API - until everyone kicked up a stink and he reversed that decision. It's hard for me not to be weary of options API (the BEST part of Vue) when the creator originally wanted it gone. :/

1

u/ejfrodo Jun 10 '21

For as long as Vue 3 exists the Options API will be available since removing it would be a backwards breaking change and become Vue 4. There's no sense in worrying about it if you just want to keep using Vue 3 which will be available and stable for a really long time. Hell you can keep using Vue 2 for the next decade if you want, it's feature rich and feature complete and will remain that way indefinitely.