Symbol

DialogProvider

import { DialogProvider } from '@shinyongjun/react-dialog'; import * as React from 'react'; import * as ReactDOM from 'react-dom/client'; import App from './App'; import '@shinyongjun/react-dialog/css'; const root = ReactDOM.createRoot(document.getElementById('root')); root.render( <React.StrictMode> <DialogProvider> <App /> </DialogProvider> </React.StrictMode> );

Alert

'use client'; import { useDialog } from '@shinyongjun/react-dialog'; export default function ReactDialogDemoDemo() { const { alert } = useDialog(); return ( <button type="button" onClick={() => alert('alert!')}> Open Alert </button> ); }

Alert Callback

'use client'; import { useDialog } from '@shinyongjun/react-dialog'; export default function ReactDialogDemoDemo() { const { alert } = useDialog(); return ( <button type="button" onClick={async () => { await alert('alert!'); console.log('Alert Close'); }} > Open Alert </button> ); }

//

Confirm

'use client'; import { useDialog } from '@shinyongjun/react-dialog'; export default function ReactDialogDemoDemo() { const { confirm } = useDialog(); return ( <button type="button" onClick={() => confirm('confirm!')}> Open Confirm </button> ); }

Confirm Callback

'use client'; import { useDialog } from '@shinyongjun/react-dialog'; export default function ReactDialogDemoDemo() { const { confirm } = useDialog(); return ( <button type="button" onClick={async () => { const result = await confirm('confirm!'); console.log(result); }} > Open Confirm </button> ); }

//

Prompt

'use client'; import { useDialog } from '@shinyongjun/react-dialog'; export default function ReactDialogDemoDemo() { const { prompt } = useDialog(); return ( <button type="button" onClick={() => prompt('prompt!')}> Open Prompt </button> ); }

Prompt Callback

'use client'; import { useDialog } from '@shinyongjun/react-dialog'; export default function ReactDialogDemoDemo() { const { prompt } = useDialog(); return ( <button type="button" onClick={async () => { const result = await prompt('prompt!'); console.log(result); }} > Open Prompt </button> ); }

//