Modern component reusability: Render props in React.
In real life, we're often working with arrays, rather than strings. In this episode, you'll learn how to use the v-for directive to filter through a list of items and render them on the page. We'll also continue our review of reactivity, in the process.
When Vue is updating a list of elements rendered with v-for, by default it uses an “in-place patch” strategy. If the order of the data items has changed, instead of moving the DOM elements to match the order of the items, Vue will patch each element in-place and make sure it reflects what should be rendered at that particular index.
A mental map I did while I was learning Vue.js. Vue (Instance) by Carlos Lopez 1. Special Attributes 1.1. key 1.2. ref 1.3. slot 2. Global Config (Vue.config).
I hope someone understands these slot props and can tell me how I can make this test pass, so I can rely on my tests when deploying. Please sign in or create an account to participate in this conversation.
Let's review one more practical component exercise, before moving on to new topics. Let's re-create the common tabs feature that you've seen on so many websites. This will give us a number of interesting techniques to review. View the source for this episode on GitHub.
When authoring components, it is good to keep in mind whether you intend to reuse this component somewhere else later. It is OK for one-off components to have some tight coupling with each other, but reusable components should define a clean public interface. The API for a Vue.js component essentially comes in three parts - props, events and slots.