Problem Statement
How do provide/inject work and when are they appropriate?
Explanation
provide/inject lets an ancestor supply values that descendants can read without prop drilling. It’s great for themes, i18n, or form groups. It is not a replacement for a global store; prefer it for localized cross-level sharing.
Code Solution
SolutionRead Only
// Ancestor
provide('theme', ref('dark'))
// Descendant
const theme = inject('theme', ref('light'))