import { h, Component, createRef } from 'preact'; class WBDialog extends Component { constructor(...args) { super(...args); this.modalRef = createRef(); } show() { $(this.modalRef.current).modal(); } hide() { $(this.modalRef.current).modal('hide'); } componentWillUnmount() { $(this.modalRef.current).modal('hide'); } render({ title, children, accept, reject }) { return (
); } } WBDialog.defaultProps = { 'title': 'Dialog', 'accept': () => {}, 'reject': () => {} }; export default WBDialog;