redraw if new quote == current quote

This commit is contained in:
2024-08-16 06:10:59 -04:00
parent 9fcff05a7b
commit bb49b188f5
+6 -1
View File
@@ -26,7 +26,12 @@ export default function Footer() {
}, [mailState]) }, [mailState])
const drawNewQuote = () => { const drawNewQuote = () => {
setQuote(quoteArray[Math.floor(Math.random() * quoteArray.length)]); const newQuote = quoteArray[Math.floor(Math.random() * quoteArray.length)]
// redraw if this quote == current quote
if (newQuote !== quote) {
setQuote(newQuote);
} else drawNewQuote();
} }
return ( return (