API Reference
@univerjs
@univerjs/core
functions
Usedependencycontext

@univerjs/core v0.4.2Docs


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.Elementsubmodules/univer/node_modules/.pnpm/@wendellhu+redi@0.16.1/node_modules/@wendellhu/redi/esm/react-bindings/reactRx.d.ts:33
valueT | undefinedsubmodules/univer/node_modules/.pnpm/@wendellhu+redi@0.16.1/node_modules/@wendellhu/redi/esm/react-bindings/reactRx.d.ts:37

Defined in

submodules/univer/node_modules/.pnpm/@wendellhu+redi@0.16.1/node_modules/@wendellhu/redi/esm/react-bindings/reactRx.d.ts:32


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.