Files
Compass/web/hooks/use-safe-layout-effect.ts
Martin Braquet ba9b3cfb06 Add pretty formatting (#29)
* Test

* Add pretty formatting

* Fix Tests

* Fix Tests

* Fix Tests

* Fix

* Add pretty formatting fix

* Fix

* Test

* Fix tests

* Clean typeckech

* Add prettier check

* Fix api tsconfig

* Fix api tsconfig

* Fix tsconfig

* Fix

* Fix

* Prettier
2026-02-20 17:32:27 +01:00

6 lines
312 B
TypeScript

import {useEffect, useLayoutEffect} from 'react'
// Note: This is kind of a hack and doesn't address the underlying problem.
// Inspired by https://github.com/react-component/overflow/issues/6#issuecomment-819215239
export const useSafeLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect