simplify chained ifs

This commit is contained in:
Zamitto 2024-05-12 16:55:54 -03:00
parent 86bca75b3f
commit 05c6c7c64d

View file

@ -63,12 +63,10 @@ export function GallerySlider({ gameDetails }: GallerySliderProps) {
useEffect(() => {
if (hasMovies && mediaContainerRef.current) {
mediaContainerRef.current.childNodes.forEach((node, index) => {
if (index == mediaIndex) {
if (node instanceof HTMLVideoElement) {
if (index == mediaIndex && node instanceof HTMLVideoElement) {
node.play()
currentVideoRef.current = node
}
}
})
}
}, [hasMovies, mediaContainerRef, mediaIndex])