reakit-playground

Reakit Playground

Usage no npm install needed!

<script type="module">
  import reakitPlayground from 'https://cdn.skypack.dev/reakit-playground';
</script>

README

reakit-playground

NPM version

Installation

npm:

npm i reakit-playground

Yarn:

yarn add reakit-playground

Usage

import React from "react";
import ReactDOM from "react-dom";
import {
  usePlaygroundState,
  PlaygroundEditor,
  PlaygroundPreview,
} from "reakit-playground";

const initialCode = `import React from "react";
import { Provider, Button } from "reakit";

function Example() {
  return (
    <Provider>
      <Button>Button</Button>
    </Provider>
  );
}
`;

function App() {
  const playground = usePlaygroundState({ code: initialCode });
  return (
    <div>
      <PlaygroundPreview {...playground} />
      <PlaygroundEditor {...playground} readOnly />
    </div>
  );
}

ReactDOM.render(<App />, document.getElementById("root"));

License

MIT © Diego Haz