score:1

Accepted answer
     const transformSpecificMark = (id) => {
            setData(
              data.map(item =>
                item.id === id
                  ? { ...item, marks: marks + 1 }
                  : item
              ))
          }


<button onClick={() => transformSpecificMark(id)}>Click</button

score:1

const updateDataById = (id) => {
      setData(prev =>
          prev.map(e => e.id === id ? {...e, mark: e.mark + 1 } : e )
      )
}

Related Query

More Query from same tag