@univerjscorefunctionsUsedependencyvalue

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


Function: useDependencyValue()

function useDependencyValue<T>(depValue$, defaultValue?): T | undefined

unwrap an observable value, return it to the component for rendering, and trigger re-render when value changes

IMPORTANT. Parent and child components better not subscribe to the same observable, otherwise unnecessary re-render would be triggered. Instead, the top-most component should subscribe and pass value of the observable to its offspring, by props or context. Please consider using useDependencyContext and useDependencyContextValue in this case.

Type Parameters

Type Parameter
T

Parameters

ParameterType
depValue$Observable<T>
defaultValue?T

Returns

T | undefined

Deprecated

Please use useObservable instead.

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:15