How to call functions in parent component

preview_player
Показать описание
✨❓ Svelte Question Time ❓✨

"You have a Svelte question, I have an answer" 😱😍

Introduction 00:00

What is the relationship between the component and its parent 01:22
There's no one size fit all solution for this. It's better to study the relationship between the components and figure out what's the best way of communication between the components

Example 1 - Passing the function as a props 05:53
Useful when the component can't live without parent, and the parent can't live without the component

Example 2 - Passing the function as listener for component events 07:13
Useful when you the component does not care about the function, whether the function is being passed to the component or not.

Example 3 - Passing the function via context 10:10
Useful when all the children and grandchildren components may or may not call the function. The function allows all children and grandchildren components to update the state / make changes to the common parent component.

---

📚 Related Resources

🔗 Want to learn more from me? Check out these links:

#svelte #sveltequestiontime

Thanks for watching 🥰 -- with love, Li Hau
Рекомендации по теме
Комментарии
Автор

That beginning made me smile.
So happy I found your channel ... I decided to go all-in with Svelte, and say goodbye to React.

billpliske
Автор

Your excitement about these videos is contagious! I look forward to all of these videos. You’re making awesome content!

ethandavidson
Автор

you just saved me from using stores!! Thank you so much! I really don't understand how this part is missing from the tutorial

MichaelDoron-kv
Автор

Thank you dear ❤️
// Use the simplest solution ✅✅✅

SusanthCom
Автор

yeah THX a lot !! now i have understand the "dispatch-thing" and it works great !! Thank you so much ! ;-)=

mackebrecht
Автор

Thank you for all you do expecially how you breakdown svelte js.

IfyDon
Автор

Good topic:
❓How to dynamically create a component and render it.
❓How to create n number of instances of a component dynamically and render it.
Here in this example, you are switching example one you're and three statically. Based on user interaction, how can we create instances of example 1, 2, 3 dynamically and render it on the run.
🔥🔥🔥

SusanthCom
join shbcf.ru