I recently gave a short talk as part of Svelte Summit Sprint 2021.
It is a super concise yet deep dive into common components composition patterns and how to implement them in Svelte, including multiple examples you can play with yourself in the REPL (links below).
This is a topic that's close to my heart because coming from React, I initially struggled to understand how I can get the same level of composability from Svelte.
You can watch my 11 minutes talk HERE (starts at the correct timestamp).
- Visual enhancement - simple dialog HOC
- Mouse tracker HOC using slot props
- Mouse tracker HOC using svelte:component
- List HOC using slot props
- List HOC using svelte:component
Special thanks to my colleague, Dune Thomas, for his help in making this