panzerdp / dmitripavlutin.com-comments

7 stars 0 forks source link

ref-reactive-differences-vue/ #159

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

5 Must-Know Differences Between ref() and reactive() in Vue

What are the main differences between ref() and reactive()? And when would you use one or another?

https://dmitripavlutin.com/ref-reactive-differences-vue/

EvgenyWas commented 1 year ago

Hello Dmitri,

Thank you for your work and for this perfect blog! I’ve read this article carefully and I have one issue. I think there isn’t one of the most important difference of usage between reactive() and ref(). It’s an opportunity to reassign a value as it’s possible with ref(), but not with ‘reactive()’.

Thanks for your time. What do you think?

panzerdp commented 1 year ago

@EvgenyWas Hi Evgeny!

I agree, it's important to mention the possibility of reassigning a value in case of ref() but not reactive(). I'll update the post with your idea!

Thanks a lot.

zhenzhenChange commented 1 year ago
  1. Dom reference.
  2. Immutability. In fact ref.value = xxx is very much a manifestation of immutability. Only for complex data types, the conversion is done internally using reactive, so it is also possible to setter trigger responsive.
panzerdp commented 1 year ago

Dom reference.

Thanks for idea @zhenzhenChange. That's also an important diff to know.

ksvanquy commented 10 months ago

thank pro !