← All notes

Vue provide and inject skip prop drilling across deep trees

Answer: Props pass data from parent to child, but a deep tree would have to thread the same prop through every ancestor. provide and inject skip that props drilling.

The pattern

A parent can be a dependency provider for all of its descendants. Any descendant, however deep, can inject dependencies provided up the parent chain.

Runtime rules

provide() can only be used inside setup(). By default an instance inherits its parent's provides object. When the instance provides its own values, it makes a new provides object whose prototype is the parent provides object. inject() can only be used inside setup() or functional components.

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources and notices: Vue.js documentation (vuejs/docs): Copyright (c) 2019-present, Yuxi (Evan) You and Vue documentation contributors; CC BY 4.0, text only (https://raw.githubusercontent.com/vuejs/docs/main/LICENSE). Vue.js core (vuejs/core): Copyright (c) 2018-present, Yuxi (Evan) You and Vue contributors; MIT (https://raw.githubusercontent.com/vuejs/core/main/LICENSE). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Vue.js docs, Provide / Inject, CC BY 4.0, text only (vuejs/docs); Vue.js core, runtime-core apiInject, MIT (vuejs/core). Notices: Vue.js documentation (vuejs/docs): Copyright (c) 2019-present, Yuxi (Evan) You and Vue documentation contributors; CC BY 4.0, text only (https://raw.githubusercontent.com/vuejs/docs/main/LICENSE). Vue.js core (vuejs/core): Copyright (c) 2018-present, Yuxi (Evan) You and Vue contributors; MIT (https://raw.githubusercontent.com/vuejs/core/main/LICENSE).

Cite this

Permanent ID: iil:note:107m26ha

iinventedlight. 2026. "Vue provide and inject skip prop drilling across deep trees." iinventedlight Library, iil:note:107m26ha, version of 2026-11-10. https://iinventedlight.com/library/notes/vue-provide-inject/. License: CC-BY-4.0.

@misc{iil_note_107m26ha,
  author = {{iinventedlight}},
  title = {{Vue provide and inject skip prop drilling across deep trees}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-10},
  url = {https://iinventedlight.com/library/notes/vue-provide-inject/},
  note = {Permanent ID iil:note:107m26ha. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/vue-provide-inject.md.