Home / Function/ provide() — vue Function Reference

provide() — vue Function Reference

Architecture documentation for the provide() function in apiInject.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  d6f9c4a5_f357_bc13_42fe_6cb60cb676ba["provide()"]
  d67548f7_f00b_fa56_7339_319189a3fea6["resolveProvided()"]
  d6f9c4a5_f357_bc13_42fe_6cb60cb676ba -->|calls| d67548f7_f00b_fa56_7339_319189a3fea6
  style d6f9c4a5_f357_bc13_42fe_6cb60cb676ba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/v3/apiInject.ts lines 7–16

export function provide<T>(key: InjectionKey<T> | string | number, value: T) {
  if (!currentInstance) {
    if (__DEV__) {
      warn(`provide() can only be used inside setup().`)
    }
  } else {
    // TS doesn't allow symbol as index type
    resolveProvided(currentInstance)[key as string] = value
  }
}

Domain

Subdomains

Frequently Asked Questions

What does provide() do?
provide() is a function in the vue codebase.
What does provide() call?
provide() calls 1 function(s): resolveProvided.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free