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.
Weekly Vue News #141 Share Styling Using Wrapper Components View online Hi 👋 I got the opportunity to raffle 3 in-person tickets for the first edition of the C3 Dev Festival in Amsterdam. You can participate here. Have a nice week ☀️ Vue 📕 Effortless Forms w/ FormKit 👉🏻 This article on FormKit teaches you how to build forms effortlessly, with a focus on great UX. 📕 Vue Tip: Best Practices for Working with Slots 👉🏻 When developing with slots in Vue.js, it's important to follow some best practices to ensure clean and maintainable code. 📹 This is the Future of Vue 👉🏻 Matt took a look at what exactly makes Vue Vapor so exciting. 📹 Should You Use Vue Slots Over Props? 👉🏻 John talks about the pros & cons of using Vue slots instead of props. 🛠️ Pinia Colada 👉🏻 An opinionated yet flexible data fetching layer on top of Pinia. 👉🏻 It's still experimental and not ready for production. 🛠️ vue-tel-input 👉🏻 International Telephone Input with Vue. 🔥 Vue Tip: Share S...
Tuesday, October 8, 2024 Podcast : I was able to write a post that appeared on Mastodon using ActivityPub. Via the WordPress API. Congrats to the ActivtyPub community, Automattic and Mastodon. "It just worked." # Okay this is blowing my mind. My friends at Automattic showed me how to turn on ActivityPub on a WordPress site. I wrote a test post in my simple WordPress editor, forgetting that it would be cross-posted to Mastodon. When I just checked in on Masto, there was the freaking post . After I recovered from passing out, I wondered what happens if I update the post in my editor, and save it to the WordPress site that's hooked up to Masto via ActivityPub. So I made a change and saved it. I waited and waited, nothing happened. I got ready to add a comment saying ahh I guess it doesn't update, when -- it updated. Oh geez look at that. Folks, I did nothing here but write an app that can be used to edit WordPress posts. And I got in return an app that...
Tuesday, August 20, 2024 My linkblog, which posts to the Links tab on Scripting News, as well as Bluesky , Mastodon and RSS , now also posts to Twitter and Threads . # Today would have been my mother's 92nd birthday. She died in 2018, and I still haven't, deep inside, fully gotten the message that she's gone. Probably the most significant person in my life. I find most of my adult relationships can be traced back to my relationship with her. # Ignore the NY Times # When President Biden took the stage last night at the DNC, I had a moment of buyer's remorse. He looked so good in his black suit, and the pictures of the new candidates, and their spouses, looked comical in comparison to the president who was about to speak. # Why did Walz have a permanent frown on his face. I find his presence next to Harris is almost always awkward. He's taller, and moves a lot. I noticed this with Sanders when he was debating Clinton in 2016. Sh...
评论
发表评论