Problem Statement
How do provide() and inject() help share state across distant components?
Explanation
provide() registers a value on an ancestor; inject() reads it from descendants without prop drilling. It’s ideal for theming, i18n, or shared services. Avoid overuse for ordinary parent-child data—props/emit are still clearer for local communication.
Code Solution
SolutionRead Only
provide('theme', themeRef)
// descendant
const theme = inject('theme', ref('light'))