redraw if new quote == current quote
This commit is contained in:
@@ -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 (
|
||||||
|
|||||||
Reference in New Issue
Block a user