diff --git a/components/RandomImage.js b/components/RandomImage.js index 9af6919..0452dd9 100644 --- a/components/RandomImage.js +++ b/components/RandomImage.js @@ -20,7 +20,7 @@ function RandomImage(props) { api.unsplash.random ) - const needsFetch = !error && !updating && (!imgs || cacheIndex > cache.length - 2) + const needsFetch = !error && !updating && (!imgs || cacheIndex > cacheRef.current.length - 2) React.useEffect(() => { if (needsFetch) {