Question: Today i try to delete a array in my react-native component but does not work, here is mi code:

```js
  let arr = buques
  await arr.splice(index, 1)
  await setBuques(arr)
  console.log(buques)
  alert('Buque eliminado') 
```

this can run in a class component and update the props :

```js
  removearray = (index)=>{
        let arr = this.state.tags
        arr.splice(index, 1)
        this.setState({tags: arr})
    }
```

i use this on .map iteration in function component this delete the array but do not update a map iteration in class component this can run

but i cant understand why does not work in function component ¿any idea? thanks for the answers

Answer: 
The **Mutability** causes this.

> 
> Mutable is a type of variable that can be changed. In JavaScript, only
> objects and arrays are mutable, not primitive values. [Source](https://developer.mozilla.org/en-US/docs/Glossary/Mutable)
> 
> 
> 

You need to change it to:

```js
await setBuques(await buques.filter((el, i) => (i === index)))
console.log(buques)

```
await is only valid in async like you can do is

```
const removeItem = async () => {
  let arr = buques
  await arr.splice(index, 1)
  await setBuques(arr)
  console.log(buques)
  alert('Buque eliminado');
} 

```

To update the array on view you need to change the ref of array data like

```
removearray = (index)=>{
        let arr = [...this.state.tags]; <-- This is trick -->
        arr.splice(index, 1)
        this.setState({tags: arr})
}

```