import{App}from'reapex'importmodalPluginfrom'reapex-plugin-modal'constapp=newApp()// 1. register the pluginconstmodal=app.use(modalPlugin,'@@modals')// 2. Create a component to render the modalsconstModals=()=>{constmodals=useSelector(modal.selectors.modals)return(<divclassName="reapex-modals">{modals.map(m=>{returnm.show ? <m.componentkey={m.name}{...m.props}/> : null
})}</div>)}// 3. Render it<Providerstore={store}><Modals/></Provider>// show/hide any componentconst{show, hide}=modal.useModal('MyDialog')dispatch(show(MyDialogComponent,props))dispatch(hide('MyDialog'))