Promise-based
await toi(Component) mounts your component and resolves with whatever it passes to resolve — an imperative call site instead of a pile of dispatched state.
const ok = await toi(Confirm);
// ok === true once resolve(true) runsA tiny, headless React utility for imperative dialogs and toasts.
Three ideas — and what they look like in your app.
await toi(Component) mounts your component and resolves with whatever it passes to resolve — an imperative call site instead of a pile of dispatched state.
const ok = await toi(Confirm);
// ok === true once resolve(true) runstoi only mounts your component and watches when it's done. No bundled styles to fight, no design system to adopt — markup, style, and motion stay entirely yours.
Calling resolve doesn't unmount right away — toi waits for exit animations to finish first, so dialogs and toasts can animate out cleanly instead of vanishing mid-transition.
resolve();
// waits for the exit animation, then unmounts