Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
manudeli committed Dec 20, 2023
1 parent c93a045 commit 18abc44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 3 additions & 7 deletions packages/react-image/src/Load.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -21,9 +17,9 @@ export const useLoad = <TLoadSrc extends LoadSrc>(

type LoadProps<TLoadSrc extends LoadSrc> = {
src: TLoadSrc;
children: FunctionComponent<HTMLImageElement>;
children: (loadedImage: HTMLImageElement) => ReactNode;
};
export const Load = <TLoadSrc extends LoadSrc>({
src,
children,
}: LoadProps<TLoadSrc>) => createElement(children, useLoad({ src }));
}: LoadProps<TLoadSrc>) => children(useLoad({ src }));
2 changes: 1 addition & 1 deletion websites/demo-react-image-next/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div>
Expand Down

0 comments on commit 18abc44

Please sign in to comment.