How to use Svelte component inside a React app?

Опубликовано: 09 Февраль 2025
на канале: lihautan
3,166
102

✨❓ Svelte Question Time ❓✨

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

How to use a Svelte component inside a React app? 00:00

We are going write a wrapper component in React, that wraps around our Svelte component.

Setting up 01:09
The React app was created using create-react-app, which ejected to support custom webpack configuration to import .svelte module.

Instantiating Svelte component 05:01
Passing props from React to Svelte 08:06
Two-way data binding 09:20
Listen to events 15:36
Svelte internal API for binding 18:52
Passing context from React to Svelte 30:34
Calling Svelte component methods from React 37:20
Updating props from React 46:25

---

📝 Source Code https://github.com/tanhauhau/svelte-c...

🎧 Svelte Tutorial for Beginners    • Svelte Tutorial for Beginners  
🎧 Svelte Question Time    • Svelte Question Time  

📚 Related Resources
Svelte https://svelte.dev
Svelte REPL https://svelte.dev/repl
react-svelte https://github.com/Rich-Harris/react-...

🥰 Support me https://www.buymeacoffee.com/lihautan

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

Twitter:   / lihautan  
Blog: https://lihautan.com/
Newsletter: https://lihautan.com/newsletter

#svelte #sveltequestiontime

Thanks for watching 🥰 -- with love, Li Hau