]> BookStack Code Mirror - bookstack/blob - resources/js/wysiwyg/lexical/core/shared/useLayoutEffect.ts
Lexical: Imported core lexical libs
[bookstack] / resources / js / wysiwyg / lexical / core / shared / useLayoutEffect.ts
1 /**
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  *
7  */
8
9 import {useEffect, useLayoutEffect} from 'react';
10 import {CAN_USE_DOM} from 'lexical/shared/canUseDOM';
11
12 // This workaround is no longer necessary in React 19,
13 // but we currently support React >=17.x
14 // https://github.com/facebook/react/pull/26395
15 const useLayoutEffectImpl: typeof useLayoutEffect = CAN_USE_DOM
16   ? useLayoutEffect
17   : useEffect;
18
19 export default useLayoutEffectImpl;