# microcms-iframe-react

> This library is for communicating with the microCMS iframe field via `postMessage`.

Latest version **0.0.6** (published 2022-05-11) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install microcms-iframe-react
pnpm add microcms-iframe-react
yarn add microcms-iframe-react
bun add microcms-iframe-react
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2022-05-11 |
| First published | 2022-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lambdasawa |

## Links

- npm: https://www.npmjs.com/package/microcms-iframe-react
- npm.io page: https://npm.io/package/microcms-iframe-react

## Recent versions

- 0.0.6 (latest) — 2022-05-11
- 0.0.5 — 2022-05-10
- 0.0.4 — 2022-05-09
- 0.0.3 — 2022-05-09
- 0.0.2 — 2022-05-09
- 0.0.1 — 2022-04-28

## README

# microcms-iframe-react

This library is for communicating with the microCMS iframe field via `postMessage`.

`postMessage` protocol is [here](https://document.microcms.io/manual/iframe-field).

This library is useful when using React.

## Usage

```jsx
import { useMicroCMSIframe } from "microcms-iframe-react";

export default function ColorPicker() {
  const [color, setColor] = useMicroCMSIframe("#00ff00", {
    origin: "https://example.microcms.io",
  });

  const onChangeColor = (e) => {
    setColor({ id: "color", data: e.target.value });
  };

  return <input type="color" value={color} onChange={onChangeColor} />;
}
```

`useMicroCMSIframe` can take the same arguments as`setup` described in the README of `microcms-iframe-api`.

---
_Source: https://npm.io/package/microcms-iframe-react · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
