mount-components

1.0.2 • Public • Published

mounted-components

Programmatically mounting and displaying components.

NPM JavaScript Style Guide

Install

npm install --save mounted-components

Usage

import React from "react";
import { useMount, MountRoot } from "mount-components";

const Modal = ({ close, content }) => {
  return (
    <div>
      {content}
      <button onClick={close}>close</button>
    </div>
  );
};

const App = () => {
  const { open } = useMount();
  function onClick(e) {
    open(Modal, {
      content: "This is a modal!",
    });
  }
  return (
    <div>
      <button onClick={onClick}>Open</button>
      <MountRoot />
    </div>
  );
};
export default App;

License

MIT © PlatzerT

Readme

Keywords

none

Package Sidebar

Install

npm i mount-components

Weekly Downloads

32

Version

1.0.2

License

MIT

Unpacked Size

1.39 MB

Total Files

24

Last publish

Collaborators

  • chbb