MENU

Fun & Interesting

Master The Svelte Context API

Joy of Code 13,665 lượt xem 5 months ago
Video Not Working? Fix It Now

Sharing state without props and events using the Svelte Context API.

πŸ”΄ Patreon: https://www.patreon.com/joyofcode
𝕏 Twitter: https://twitter.com/joyofcodedev
πŸ’¬ Discord: https://discord.com/invite/k6ZpwAKwwZ
πŸ”₯ Uses: https://www.joyofcode.xyz/uses

πŸ”— Post: https://joyofcode.xyz/master-the-svelte-context-api
πŸ”— Context API: https://svelte.dev/docs/svelte/context
πŸ”— Using Stores With Context: https://svelte.dev/docs/kit/state-management#Using-stores-with-context

πŸ”– Timestamps

0:00 Intro
0:21 Sponsor
0:37 The Prop Drilling Problem
1:33 Creating The Context API Yourself
5:05 Passing Reactive State Through Context
7:22 Using Unique Keys For Context
9:14 The Svelte Context API
9:52 How The Context API Works
10:19 Global State Versus Context
11:27 How The Context API Works Under The Hood
13:28 Encapsulating And Typing Context
15:10 Practical Example Of Using The Context API
17:57 Outro

#joyofcode #sveltekit #svelte

Comment