0.0.6 • Published 2 years ago

microcms-iframe-react v0.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

microcms-iframe-react

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

postMessage protocol is here.

This library is useful when using React.

Usage

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 assetup described in the README of microcms-iframe-api.

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago