Skip to content

Commit 857b288

Browse files
committed
remove fallback zero image
1 parent 6b59878 commit 857b288

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

docs/working-notes/todo4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ for screenshots use new not private window and select window in screenshot tool,
5858
breadcrumb navigation, projects
5959
random image client component for Home page, onClick
6060
use picture with srcSet for Home image
61+
solve loading fallback for async client image
6162
```
6263

6364

src/components/react/ImageRandom.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ interface Props extends ImgHTMLAttributes<HTMLImageElement> {
1010
allImagesSrc: string[];
1111
}
1212

13+
const initialSrc = '';
14+
1315
const ImageRandomReact: FC<Props> = ({ allImagesSrc, className, ...props }) => {
14-
const [imageSrc, setImageSrc] = useState(allImagesSrc[0]);
16+
const [imageSrc, setImageSrc] = useState(initialSrc);
1517

1618
useEffect(() => {
1719
const run = async () => {
@@ -33,7 +35,7 @@ const ImageRandomReact: FC<Props> = ({ allImagesSrc, className, ...props }) => {
3335
src={imageSrc}
3436
onClick={handleClick}
3537
className={cn('cursor-pointer', className)}
36-
alt="Random Hero image"
38+
alt="Hero image"
3739
/>
3840
);
3941
};

0 commit comments

Comments
 (0)