# @rc-component/mutate-observer

> React MutateObserver Component

Latest version **2.0.1** (published 2025-11-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @rc-component/mutate-observer
pnpm add @rc-component/mutate-observer
yarn add @rc-component/mutate-observer
bun add @rc-component/mutate-observer
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2025-11-28 |
| First published | 2023-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.x |
| Dependencies | 1 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | 574980606@qq.com |
| Maintainers | zombiej, afc163, madccc, peachscript, chenshuai2144 |
| Keywords | react, react-component, mutate-observer |

## Links

- npm: https://www.npmjs.com/package/@rc-component/mutate-observer
- Repository: https://github.com/react-component/mutate-observer
- Issues: https://github.com/react-component/mutate-observer/issues
- npm.io page: https://npm.io/package/@rc-component/mutate-observer

## Dependencies (1)

- [@rc-component/util](https://npm.io/package/@rc-component/util.md) ^1.2.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2025-11-28
- 2.0.0 — 2025-01-24
- 1.1.0 — 2023-08-07
- 1.0.0 — 2023-01-09
- 1.0.0-alpha.1 — 2023-01-05

## README

# @rc-component/mutate-observer

MutateObserver for React.


[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]
[![build status][github-actions-image]][github-actions-url]
[![Codecov][codecov-image]][codecov-url]
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![dumi][dumi-image]][dumi-url]

[npm-image]: https://img.shields.io/npm/v/@rc-component/mutate-observer.svg?style=flat-square
[npm-url]: http://npmjs.org/package/@rc-component/mutate-observer
[github-actions-image]: https://github.com/react-component/mutate-observer/actions/workflows/main.yml/badge.svg
[github-actions-url]: https://github.com/react-component/mutate-observer/actions/workflows/main.yml
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/mutate-observer/master.svg?style=flat-square
[codecov-url]: https://app.codecov.io/gh/react-component/mutate-observer
[david-url]: https://david-dm.org/react-component/mutate-observer
[david-image]: https://david-dm.org/react-component/mutate-observer/status.svg?style=flat-square
[david-dev-url]: https://david-dm.org/react-component/mutate-observer?type=dev
[david-dev-image]: https://david-dm.org/react-component/mutate-observer/dev-status.svg?style=flat-square
[download-image]: https://img.shields.io/npm/dm/@rc-component/mutate-observer.svg?style=flat-square
[download-url]: https://npmjs.org/package/@rc-component/mutate-observer
[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/mutate-observer
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/mutate-observer
[dumi-url]: https://github.com/umijs/dumi
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square

## Development

```bash
npm install
npm run start
open http://localhost:8000
```

## Install

[![@rc-component/mutate-observer](https://nodei.co/npm/@rc-component/mutate-observer.png)](https://www.npmjs.com/package/@rc-component/mutate-observer)

## Usage

```tsx | pure
import React from 'react';
import MutateObserver from 'rc-component/mutate-observer';

const onMutate = (mutations: MutationRecord[], observer: MutationObserver) => {
  console.log(mutation);
  console.log(observer);
};

const Demo: React.FC = () => {
  return (
    <MutateObserver onMutate={onMutate}>
      <div>test</div>
    </MutateObserver>
  );
};

export default Demo;
```

## 🔥 API

We use typescript to create the Type definition. You can view directly in IDE. But you can still check the type definition [here](https://github.com/react-component/mutate-observer/blob/master/src/interface.ts).

### mutate-observer

| Prop     | Description                                                                                                      | Type                 | Default |
| -------- | ---------------------------------------------------------------------------------------------------------------- | -------------------- | ------- |
| onMutate | A function which will be called on each DOM change that qualifies given the observed node or subtree and options | MutationCallback     | -       |
| options  | An object providing options that describe which DOM mutations should be reported to mutationObserver's callback  | MutationObserverInit | -       |

---
_Source: https://npm.io/package/@rc-component/mutate-observer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
