diff --git a/packages/react-image/src/Load.ts b/packages/react-image/src/Load.ts index e517292..9305a29 100644 --- a/packages/react-image/src/Load.ts +++ b/packages/react-image/src/Load.ts @@ -1,9 +1,5 @@ import { LoadClient, type LoadSrc } from "@fepack/image"; -import { - type FunctionComponent, - createElement, - useSyncExternalStore, -} from "react"; +import { ReactNode, useSyncExternalStore } from "react"; const loadClient = new LoadClient(); @@ -21,9 +17,9 @@ export const useLoad = ( type LoadProps = { src: TLoadSrc; - children: FunctionComponent; + children: (loadedImage: HTMLImageElement) => ReactNode; }; export const Load = ({ src, children, -}: LoadProps) => createElement(children, useLoad({ src })); +}: LoadProps) => children(useLoad({ src })); diff --git a/websites/demo-react-image-next/src/app/page.tsx b/websites/demo-react-image-next/src/app/page.tsx index dd2b913..258ceb0 100644 --- a/websites/demo-react-image-next/src/app/page.tsx +++ b/websites/demo-react-image-next/src/app/page.tsx @@ -7,7 +7,7 @@ import { useState } from "react"; import { Spinner } from "~/components/uis"; export default function Home() { - const [size, setSize] = useState(1); + const [size, setSize] = useState(8); return (