---
description: Remove all data of a collection
---

# clearCollection

### `removeItem({object to delete} , (success)=> {}, (error)=> {})`

## How to use:

```jsx
my_collection.clearCollection(
    () =>  // removed successfully,
    (error) => alert(error) 
);
```

## Arguments:

| parameter        | required | types    |
| ---------------- | -------- | -------- |
| success callback | yes      | function |
| failure callback | yes      | function |

## Example:

```jsx
import React,{useEffect} from 'react';
import {Text} from 'react-native';
import {Pleex} from 'pleex';

const App = () => {
  
  // Create collection
  const my_collection = Pleex.collection('myCollection');
  
  // Get all data saved
  my_collection.clearCollection(
    () =>  // Success,
    (error) => alert(error) 
  );
  
  return (
    <>
      <Text>Try clear collection api</Text>
    </>
  );

};

export default App;
```
