react-modal-hoc
React higher-order component (HOC) that allows to wrap your component with modal isOpen
API. Also can be used as a decorator.
Inspired by react-modal.
Installation
yarn add react-modal-hoc
Api
Properties
ComponentpropTypes = isOpen: PropTypesboolisRequired wrappedRef: PropTypesfunc;
Example
// components/modal.js:;; const Modal = <div className="modal">/* Some modal body here */</div>; Modal; // components/index.js:;; { superprops; thistoggle = thistoggle; thisstate = isOpenModal: false ; } { window; } { this; } { return <div className="app"> <Modal isOpen=thisstateisOpenModal /> </div> ; }
License
MIT