
Follow up to #3129 ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [x] `sdk` — Changes the tldraw SDK - [x] `improvement` — Improving existing features ### Test Plan 1. Add a step-by-step description of how to test your PR here. 2. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Add a brief release note for your PR here.
10 lines
340 B
TypeScript
10 lines
340 B
TypeScript
import React from 'react'
|
|
import { useTrackedScheduler } from './useTrackedScheduler'
|
|
|
|
/** @internal */
|
|
export function useLayoutReaction(name: string, effect: () => void): void {
|
|
const scheduler = useTrackedScheduler(name, effect)
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
React.useLayoutEffect(scheduler.maybeExecute)
|
|
}
|