@univerjscorefunctionsUsedependencycontext

@univerjs/core v0.5.0-beta.1Docs


Function: useDependencyContext()

function useDependencyContext<T>(depValue$, defaultValue?): {
  Provider: (props) => JSX.Element;
  value: T | undefined;
}

subscribe to an observable value from a service, creating a context for it so it child component won’t have to subscribe again and cause unnecessary

Type Parameters

Type Parameter
T

Parameters

ParameterType
depValue$Observable<T>
defaultValue?T

Returns

{
  Provider: (props) => JSX.Element;
  value: T | undefined;
}
NameTypeDefined in
Provider(props) => JSX.Elementpackages/api/tmp/univer-pro/node_modules/.pnpm/@wendellhu+redi@0.16.1/node_modules/@wendellhu/redi/esm/react-bindings/reactRx.d.ts:33
valueT | undefinedpackages/api/tmp/univer-pro/node_modules/.pnpm/@wendellhu+redi@0.16.1/node_modules/@wendellhu/redi/esm/react-bindings/reactRx.d.ts:37

Defined in

packages/api/tmp/univer-pro/node_modules/.pnpm/@wendellhu+redi@0.16.1/node_modules/@wendellhu/redi/esm/react-bindings/reactRx.d.ts:32