Releases: trendmicro-frontend/react-modal
Releases · trendmicro-frontend/react-modal
v3.1.0
This release provides React Context and Hook API support.
Context API
<ModalProvider>
<ModalRoot />
<ModalConsumer>
{({ openModal, closeModal }) => {
const handleClick = (e) => openModal(MyModal);
return (
<Button onClick={handleClick}>
Open Modal
</Button>
);
}}
</ModalConsumer>
</ModalProvider>
Hook API
const Example = (props) => {
const { openModal, closeModal } = useModal();
const handleClick = (e) => openModal(MyModal);
return (
<Button onClick={handleClick}>
{props.children}
</Button>
);
}
v3.0.0
There are a few breaking changes in this release and requires upgrading React to 16.3.
- The disableOverlay prop is deprecated and will be removed in the next major release. Use disableOverlayClick instead.
https://github.com/trendmicro-frontend/react-modal/blob/v3.0.0/src/Modal.jsx#L114-L123 - Integrate Webpack 4, Babel 7 and Styleguidist
- Update the code to use the React.createRef() API introduced in React 16.3