I teamed up with the amazing Michael Thiessen to promote our newsletters cross-wise. He shares great Vue tips and insights each week, and his newsletter was the main inspiration for this one. Check it out if you haven't already.
The main difference between our newsletters is that Michael's is focused on Vue tips and insights, while my newsletter provides Vue & Nuxt tips and curated links to articles, videos, events, and more. I hope you enjoy both newsletters and find them valuable.
👉🏻 A lightweight & flexible Vue 3 library for creating applications with the 2D rendering system PixiJS.
🔥 Vue Tip: When You Should Use a Composable
Vue Composables are a way to encapsulate logic in a reusable way and they are one of my favorite features of Vue 3.
They are a great way to share logic between components, but I often see them used in places where they are not needed. In this short tip, I will explain when you should use a composable and when you should not.
What do you think, would you call this method a composable or not?
The answer is: No.
Let's take a look at the official documentation: "In the context of Vue applications, a "composable" is a function that leverages Vue's Composition API to encapsulate and reuse stateful logic".
The key part here is stateful logic which involves "managing state that changes over time". In our example, we are not using any reactive state, so this is not a composable. I would call it a utility/helper function.
Let's define a simple rule of thumb: If your function does not manage any reactive state, doesn't register any lifecycle hooks or doesn't provide/inject anything, it is not a composable.
Finally, let's take a look at a good example of a composable:
This composable manages the mouse position and provides two reactive values. It also registers and unregisters an event listener when the component is mounted and unmounted.
👉🏻 Dave wrote an in-depth article about theory and practice of migrating any existing Nuxt site to layers – with detailed, step-by-step instructions and gotchas.
👉🏻 "Time to first byte" is a solid metric for understanding how your web performance measures up, and is arguably one of the more important considerations for ecommerce.
👉🏻 Kirby is a classic Nintendo game where you control a squishy pink alien with a massive appetite. 👉🏻 In this freeCodeCamp course, you'll code your own version of Kirby that runs in a browser.
👉🏻 The Google team unveiled the Web Platform Dashboard, a way to see the web platform mapped as a set of features, along with their cross browser support.
😂 Fun
Comments? Join the discussion about this issue in our Discord community.
How's it going? I was planning to release the update for Reusable Components yesterday, but things haven't gone as planned. Instead, I will be launching it next week. I need a just a bit more time to make sure that the quality is up to my standards. As I've been updating the course and re-writing all the content and step-by-step refactorings, I've also been able to simplify a few things. It's just like refactoring a piece of code, and it's one of the greatest feelings. I also looked at how much content is in there, and it looks like it will be similar to the Clean Components Toolkit. Lots of great content on how to write highly reusable components, simplified and updated — I can't wait to release the update next week! Oh, and one more thing: I'm doing a podcast with Alex Lichter ! It's called Deja Vue and we'll be releasing the first ...
Monday, November 20, 2023 I'd pay $10K up front # Matt Mullenweg : "Sales of the 100-year plan so far: 0. Hundreds of people filled out the form, though. I think we really messed something up in the follow-up, including not making it self-serve to start. Will review and try again. It's an important promise to us." # I'm very much a customer for this service. It would be worth $10K for to buy 100 years of persistence for my web writing. A simple easy to understand service that helps get the process started. # I transfer scripting.com to Automattic as registrar. # I upload the contents from S3 to Automattic server. Static files, HTML, feeds, images, code. # Automattic provides an API to keep the files updated and so I can add to them as long as I'm still writing. # The files are publicly accessible over HTTP. # Automattic agrees to renew the domain for 100 years, and manage access to the files, with reasona...
评论
发表评论