MCPcopy
hub / github.com/vuejs/core / useSSRContext

Function useSSRContext

packages/runtime-core/src/helpers/useSsrContext.ts:6–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4export const ssrContextKey: unique symbol = Symbol.for('v-scx')
5
6export const useSSRContext = <T = Record<string, any>>(): T | undefined => {
7 if (!__GLOBAL__) {
8 const ctx = inject<T>(ssrContextKey)
9 if (!ctx) {
10 __DEV__ &&
11 warn(
12 `Server rendering context not provided. Make sure to only call ` +
13 `useSSRContext() conditionally in the server build.`,
14 )
15 }
16 return ctx
17 } else if (__DEV__) {
18 warn(`useSSRContext() is not supported in the global build.`)
19 }
20}

Callers 1

doWatchFunction · 0.90

Calls 2

injectFunction · 0.90
warnFunction · 0.90

Tested by

no test coverage detected