usestate update object in array code example
Example 1: React update state array of objects hooks
React find and update state value
Example 2: how to update react state array
const [myArray, setMyArray] = useState([1,2,3])
// to update
setMyArray([...myArray, 4]); // --> myArray = [1,2,3,4]
Example 3: how to update array in react state
this.setState(prevState => ({
arrayvar: [...prevState.arrayvar, newelement]
}))
Example 4: React update state array of objects hooks
React fin and update state value