You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
454 B
17 lines
454 B
import * as React from 'react'
|
|
|
|
const isBrowser = typeof document !== 'undefined'
|
|
|
|
const syncFallback = create => create()
|
|
|
|
const useInsertionEffect = React['useInsertion' + 'Effect']
|
|
? React['useInsertion' + 'Effect']
|
|
: false
|
|
|
|
export const useInsertionEffectAlwaysWithSyncFallback = !isBrowser
|
|
? syncFallback
|
|
: useInsertionEffect || syncFallback
|
|
|
|
export const useInsertionEffectWithLayoutFallback =
|
|
useInsertionEffect || React.useLayoutEffect
|