We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f3de678 commit e1cc1d1Copy full SHA for e1cc1d1
packages/hooks/use-image/src/index.ts
@@ -6,6 +6,7 @@ import type {ImgHTMLAttributes, SyntheticEvent} from "react";
6
7
import {useRef, useState, useEffect, MutableRefObject} from "react";
8
import {useIsHydrated} from "@nextui-org/react-utils";
9
+import {useSafeLayoutEffect} from "@nextui-org/use-safe-layout-effect";
10
11
type NativeImageProps = ImgHTMLAttributes<HTMLImageElement>;
12
@@ -95,7 +96,7 @@ export function useImage(props: UseImageProps = {}) {
95
96
}
97
};
98
- useEffect(() => {
99
+ useSafeLayoutEffect(() => {
100
if (isHydrated) {
101
setStatus(setImageAndGetInitialStatus(props, imageRef));
102
0 commit comments