---
title: clearStorage
nav:
  title: Tools
  path: /tools
group:
  title: Storage
toc: content
---

## clearStorage

Demo:

```tsx
/**
 * title: 基础用法
 * description: 清空 storage 存储函数
 */

import React from 'react';
import { clearStorage } from 'aim-tools';

export default () => (
  <pre>
    <code>
      clearStorage(); // 清空 localStorage 中的内容
      <br />
      <br />
      clearStorage(true); // 清空 sessionStorage 中的内容
    </code>
  </pre>
);
```

### API

```typescript
clearStorage(isSessionStorage: boolean);
```

### Params

| 参数             | 说明                  | 类型    | 默认值 | 必填 |
| :--------------- | :-------------------- | :------ | :----- | :--- |
| isSessionStorage | 是否为 sessionStorage | boolean | false  | 否   |

### Returns

| 返回值 | 说明 |
| :----- | :--- |
| ----   | ---- |
