How can I go about changing a boolean value after conditionally rendering something in react?
I want to make a conditional render in React and afterwards change the value of a boolean used in the condition, but have no idea on how you do it. It's something simple that is useful so i suspect it is possible somehow, but have no idea about the correct syntax/method and my google search results are filled with irrelevant stuff.
let hasBeenPrinted = false
return(
{deals.map((deal) => (
deal.value>10000 && !hasBeenPrinted && <h4>Congratulations on your first big deal</h4>
<Deal deal={deal} />
)
)
So what I want to do here is to change the value of hasBeenPrinted to true so that the congratulations text will only be printed once.