I am rendering <div>’s of info through .map() over an array, and have a button next to each that
onClick={() => setShow(!show)}
so basically just opens and closes the div showing the info. What happens at the moment it clicking the button next to any div opens all the div info components, where as I’m trying to simply open the div where the button was clicked. Here’s a snippet:
const [show, setShow] = React.useState(false)
Const Info = () => {
Return (
...
news.map(info => {
<>
... div of info (only shown when show === true)
<button onClick={() = setShow(!show)}
</>
}
)
}
Any advice would be greatly appreciate, sorry for the terrible grammar / layout (doing this on my phone)