diff --git a/packages/react/src/hooks/index.ts b/packages/react/src/hooks/index.ts index 7227cf4d9..5e354cd50 100644 --- a/packages/react/src/hooks/index.ts +++ b/packages/react/src/hooks/index.ts @@ -1,5 +1,6 @@ +export { useIsChanged } from './useIsChanged' export { useIsMounted } from './useIsMounted' +export { useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect' export { useKey } from './useKey' export { usePrevious } from './usePrevious' -export { useIsChanged } from './useIsChanged' export { useSetTimeout } from './useSetTimeout' diff --git a/packages/react/src/hooks/useIsomorphicLayoutEffect.ts b/packages/react/src/hooks/useIsomorphicLayoutEffect.ts new file mode 100644 index 000000000..645e6e090 --- /dev/null +++ b/packages/react/src/hooks/useIsomorphicLayoutEffect.ts @@ -0,0 +1,3 @@ +import { useEffect, useLayoutEffect } from 'react' +const isClient = typeof window !== 'undefined' +export const useIsomorphicLayoutEffect = isClient ? useLayoutEffect : useEffect diff --git a/packages/react/src/utils/index.ts b/packages/react/src/utils/index.ts index 214d840aa..7c44ce936 100644 --- a/packages/react/src/utils/index.ts +++ b/packages/react/src/utils/index.ts @@ -1,3 +1,3 @@ +export { assert } from './assert' export { hasResetKeysChanged } from './hasResetKeysChanged' export { hashKey } from './hashKey' -export { assert } from './assert'