provide-inject

Share parent data to descendant components using provide() and inject().

235|25|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/PatternsDev/skills --skill provide-inject
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: provide-inject
Source: https://github.com/PatternsDev/skills/tree/main/vue/provide-inject
Command: npx skills add https://github.com/PatternsDev/skills --skill provide-inject

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Passing data through many layers of components often requires prop drilling, which becomes hard to maintain. Provide/inject offers a clean alternative to share data with descendants without threading props.

Core Features & Use Cases

  • Share data from a parent to all descendants without prop drilling.
  • Access provided data in deeply nested components to implement cross-cutting concerns like theme, locale, or authentication.
  • Use app.provide for global data and inject in descendants to consume it.

Quick Start

Provide data in a parent component using provide() and access it in descendants with inject().

Frequently Asked Questions about provide-inject

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share data across nested Vue components without prop drilling?

To share data across nested Vue components without prop drilling, use the provide/inject pattern. A parent component uses provide() to share data, and descendants use inject() to access it, bypassing intermediate layers entirely.

What is dependency injection in Vue used for?

Dependency injection in Vue is used to share app-wide data like theme, locale, or authentication state. By using app.provide globally or provide() in a parent, descendants can inject this cross-cutting data without threading props.

How do I access provided data in a deeply nested component?

To access provided data in a deeply nested component, call inject() within the descendant component. This retrieves the values previously exposed by an ancestor using provide(), allowing direct access regardless of tree depth.

Can I use provide and inject for app-wide state like theme and authentication?

Yes, you can use provide and inject for app-wide state like theme and authentication. Use app.provide to register global data at the application level, then inject it into any descendant component to consume the shared state.

When should I use provide inject instead of passing props?

You should use provide inject instead of passing props when dealing with deeply nested component trees where prop drilling becomes hard to maintain. It offers a clean alternative for threading data through multiple layers.

Does provide inject replace component communication via props entirely?

Provide inject does not replace component communication via props entirely, but rather solves specific prop drilling issues. It is best applied to cross-cutting concerns and deeply nested structures, whereas standard props remain suitable for direct parent-child data flow.