I had this problem several counts to be increment upon click.
let count = [{id: 1, value 0}, {id: 2, value 0}]
const [counter,setCounter] = useState(counter)
increment = () => {
I want to set counter value depends on the button click and the counter will add 1 only to the specific count above.
}
return <div>
<input type='text' value='count1'>{count1}</h2> <- I know that this does not work
<button onClick={increment()}>+</button>
<input type='text' value='count1'>{count2}</h2>
<button onClick={increment()}>+</button>
Thanks.
setCounter({count1: 2, ...counter})