Question: Trying to update one element of an array in this.state I'm getting an (expected ,) error but cant see where I've gone wrong. Do I need to create a temporary array update that, then assign the whole array back to the state

This is essentially what I have

```
this.state = { array: ['a', 'b', 'c'] };

onBack() {
  this.setState({
      array[2]: 'something' 
  });
}

```

Answer: 
Manoj's answer will work, there is another way using the updater function *(funtinal `setState`)* for `setState` (which you can read about [here](https://reactjs.org/docs/react-component.html#setstate "setState"))

```js
onBack() {
  this.setState(prevState => {
    let newArray = prevState.array
    newArray[2] = "something"
    return { array: newArray }
  });
}

```
using hooks
===========

```
const [totalSet, setTotalSet] = useState(null);

```

console.log(totalSet); // {sets: Array(3), subscribed: false}

```
setTotalSet(datas => ({
    ...datas,
    sets: updatedSet,
  }));

```