From 33915d41c1f7d2e9955670981ff5546c5514fdd6 Mon Sep 17 00:00:00 2001 From: Mike Fix Date: Thu, 14 Mar 2019 10:14:44 -0700 Subject: [PATCH] fix bug in Random image --- components/RandomImage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {