How to actually pass Svelte component through props?

How to actually pass Svelte component through props? ✨❓ Svelte Question Time ❓✨ “You have a Svelte question, I have an answer“ 😱😍 In the last video, , some of you are unimpressed with my take on passing component through props is to use named slots. Well, you are right! That’s no passing component through props, it’s more of passing element through props. In this video, we are going to explore how we can actually pass Svelte component through props. Introduction 00:00 We will start with a React component 01:07 Observing how it’s done in React, and we are going to convert it to a Svelte component Converting React component to Svelte component 05:39 Using svelte:component 08:32 Svelte event listener on:input, instead of React’s onChange 11:12 You can’t spread event listeners in Svelte 13:38 Spreading attributes through $$restProps 15:03 Use component event for the dynamic Svelte component 16:38 Use props value binding for dynamic Svelte component 20:42 Summary 27:44 --- 🎧
Back to Top