Feels like I'm frustratingly close to solving this, but not sure how to update all of the values in a given object array with useState. Here's an example:
const [data, setData] = useState([
{key: 1,
value: 25},
{key: 2,
value: 30}
])
And then assume on a button click I want to add 10 to the value of every item in the array:
const handleClick = () => {
const newData = data.map(item => item.value + 10)
setData ([
...data, ???
])
newData delivers an updated array, but I'm not sure how to use the Hook to update the state. Thanks!