From 84f625fe16b9032013b321183e91494cc60a8a62 Mon Sep 17 00:00:00 2001 From: plebbitor Date: Fri, 3 Mar 2023 14:44:34 +0100 Subject: [PATCH] fixed ImageBanner rendering --- src/components/ImageBanner.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/ImageBanner.jsx b/src/components/ImageBanner.jsx index 2d40c712..c881185f 100644 --- a/src/components/ImageBanner.jsx +++ b/src/components/ImageBanner.jsx @@ -1,15 +1,17 @@ import React, { useState, useEffect } from 'react'; +import { useLocation } from 'react-router-dom'; const ImageBanner = () => { const [currentImage, setCurrentImage] = useState(1); + const location = useLocation(); useEffect(() => { setCurrentImage(Math.floor(Math.random() * 13) + 1); - }, []); + }, [location.key]); return ( ); }; -export default ImageBanner; \ No newline at end of file +export default ImageBanner;