Reactivity in Vue.js
Reactivity in Vue.js
Mastering control over reactivity with Composition API. Special Launch Offer: The book is currently 20% complete. Secure your copy now and get it at an exclusive early bird price!
About the Book
In this book, we will explore both the automatic reactivity feature provided by the Options API in Vue 2 and the added reactivity capabilities in Vue 3, which requires explicit usage of the Composition API. Vue 2's reactivity model can be perceived as automatic, as it handles reactivity behind the scenes without requiring explicit setup from developers. On the other hand, Vue 3's Composition API empowers developers with a more precise approach, providing increased control over the reactivity.
In the realm of reactivity, the Vue 3 framework doesn't seek to replace Vue 2 but rather extends its capabilities, adding a new dimension of possibilities and empowering developers with enhanced reactivity features. This ensures that both Vue 2 developers, who are accustomed to the automatic reactivity, and those transitioning to Vue 3 can work comfortably with the reactivity system that best suits their preferences and project needs. Get ready to explore the full potential of Vue.js reactivity in this exciting journey!
Table of Contents
- 1:Reactivity, a first look
- 1.1:Non-reactive examples
- 1.2:Reactive examples
- 2:Running the examples in this book
- 2.1:Inline Vue template in HTML
- 2.2:Running Vue.js examples locally with Node.js
- 2.3:Running SFCs locally with Node.js and Vue CLI
- 2.4:Running SFC Examples with Online Environments
- 3:Reactivity with Composition API
- 3.1:Example showcasing
ref()
andreactive()
- 3.2:Introduction to the reactivity utilities
- 3.3:Reference-based reactivity with
ref()
- 3.4:Object-based reactivity with
reactive()
- 3.5:Takeaway: choose the right reactivity utility
- 3.6:The reactivity helper utilities.
- 3.1:Example showcasing
- 4:Caveats
- 4.1:Copying reactive references
- 4.2:decoupling behavior
- 4.3:Reassigning a
reactive()
- 4.4:Update a
ref()
array only through the reactive reference.
- 4.5:Watchers and
ref()
trade-off between deep reactivity and performance
- 4.6:
ref()
and array methods that mutate
- 4.7:Replacing entire objects
- 4.8:Limitations with making primitives
reactive()
- 4.9:Static snapshots disrupt
reactive()
objects
- 4.10:A
reactive()
created object cannot be unwrapped
- 5:Reactivity under the hood (not complete)
- 5.1:How Vue 3 improves on Vue 2’s reactivity
- 5.2:The underlying reactivity implementation
- 5.3:How Vue internally keeps track of the dependencies.
- 6:Debugging Code
- 7:Understanding the Vue application instance and mounting to the DOM
- 7.1:The Application Instance
- 7.2:Inspecting the application Instance
- 7.3:Application instance initialization patterns
- 7.4:More about
render()
- 8:The MVVM design pattern
- 1:Reactivity, a first look
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them