Equivalent of React's useLayoutEffect in Svelte

72 views Asked by At

I'm porting a React hook to Svelte 4. The hook uses React's useLayoutEffect. According to the React docs:

useLayoutEffect is a version of useEffect that fires before the browser repaints the screen.

Is there an simple way to replicate this functionality in Svelte either through a built in utility or with a custom function?

1

There are 1 answers

0
iicaptain On

The closest equivalent is Svelte's onMount function.