Scaling UpLesson 35Free preview
Vue Provide/Inject
This lesson is part of Vue · All levels
Summary
Provide and inject provide a way to send data to many derivative components without the need to pass props at each level (prop drilling). The parent component declares the data via provide, and then any component underneath it can take it injected. For changing data, you can reactivate the value with ref or computed.
Key points
- Provide sends data down to many child components without prop drilling.
- Injects are used by the offspring to take the data provided.
- Provide suitable for shared theme, preference, or application data.
- Reactive values can be provided by ref or computed.
- The symbol is used as a key to avoid name conflicts.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.