import * as React from 'react'; import { CSSTransition, TransitionGroup } from 'react-transition-group'; export interface ModalRendererProps extends React.HTMLProps { /** * Array of modals to be rendered. */ modals: ReadonlyArray; } const TIMEOUT = { appear: 300, enter: 300, exit: 200, }; /** * Required to render modals. * Should be rendered in the root of your app. * See the [Modal](#modal) section for a full example. */ const ModalRenderer = (props: ModalRendererProps) => { const { modals } = props; return ( {modals && modals.map((modal, index) => (
{modal}
))}
); }; export default React.memo(ModalRenderer);