useStateTracking
See source codeWraps some synchronous react render logic in a reactive tracking context.
This allows you to use reactive values transparently.
See the track component wrapper, which uses this under the hood.
function useStateTracking<T>(name: string, render: () => T, deps?: unknown[]): TExample
function MyComponent() {
return useStateTracking('MyComponent', () => {
const editor = useEditor()
return <div>Num shapes: {editor.getCurrentPageShapes().length}</div>
})
}Parameters
| Name | Description |
|---|---|
| |
| |
| |
Returns
TPrev
useReactorNext
useValue