mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fixed ImageBanner rendering
This commit is contained in:
@@ -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 (
|
||||
<img id="banner-img" src={`/assets/banners/banner-${currentImage}.jpg`} alt="banner" />
|
||||
);
|
||||
};
|
||||
|
||||
export default ImageBanner;
|
||||
export default ImageBanner;
|
||||
|
||||
Reference in New Issue
Block a user