I have a div element in which I want to show one item on a click of a button. But every time a user clicks a button, I want him to be able to add another item, and another, etc. Making it a list.
How do I accomplish this with React?
I know I have to separate an item, right?
const Item = () => (
<div>
<h1>Hello</h1>
</div>
)
And then? I'm assuming it's not the same as simply showing/hiding a div with ternary operators? Because the button needs to add +1 every time someone clicks it. Or am I wrong?
Can someone please point me in the right direction because I'm not sure how to search this? Thank you!