setContext() and getContext()
Provide and consume context values scoped to a component subtree.
What is Context
Context lets a parent component pass data to all its descendants without prop drilling.
Import Helpers
From svelte.
import { setContext, getContext } from "svelte";All lessons in this course
- setContext() and getContext()
- Context vs Stores: When to Use Each
- Typed Context with TypeScript
- Context for Dependency Injection