react-mc-dnd-frame

react-mc-dnd-frame

Usage no npm install needed!

<script type="module">
  import reactMcDndFrame from 'https://cdn.skypack.dev/react-mc-dnd-frame';
</script>

README

react-mc-dnd-frame

Make react-dnd work for iframe.

Installation

Using npm:

$ npm install --save react-mc-dnd-frame

Usage

import React, { useContext } from 'react';
import { FrameContext } from 'react-frame-component';

import Frame from 'react-mc-dnd-frame';

const Content = (props = {}) => {
  const context = useContext(FrameContext);

  const {
    document: contextDocument = document,
    window: contextWindow = window,
  } = context;

  return (
    <div className="content" {...props} />
  );
};

const App = (props = {}) => {
  const [value = {}, setValue] = useState({});

  return (
    <Frame className="app-frame">
      <Content>content</Content>
    </Frame>
  );
};

export default App;