remix-toast provides utility functions to manage server-side toast notifications within Remix applications, leveraging web standards like `Set-Cookie` for flash messages. It seamlessly integrates with Remix's `loader` and `action` functions and supports React Router v7. The current stable version is 4.0.0, which includes an upgrade to Zod v4. The package appears to have an active release cadence, with frequent updates (minor and patch releases) to address bug fixes, introduce new features like `replaceWithFlash`, and maintain compatibility with new versions of Remix and React Router (e.g., v7.9+ for `react-router`). Key differentiators include its server-side first approach, middleware support for global toast management, and flexible session storage configuration, allowing custom utility creation with `createToastUtilsWithCustomSession`.
npm install remix-toastVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up server-side toast notifications in a Remix application using `remix-toast`. It covers configuring a session storage, initializing the `toast` utility, extracting and displaying toasts in a `loader` and `action`, and rendering them on the client-side.
Update all instances of `jsonSuccess`, `jsonError`, etc., to `dataSuccess`, `dataError` respectively.
Implement the middleware setup in your `root.tsx` as described in the v3.0.0 changelog, specifically importing from `remix-toast/middleware` and handling `getToast` in your root loader.
Ensure your `react-router` peer dependency is at least `7.9.0` (or higher if specified by `remix-toast`) to guarantee stable middleware functionality.
Review your project's direct `zod` dependencies and upgrade them to v4 if conflicts arise or if you encounter type mismatches related to `zod` schemas used in conjunction with `remix-toast`.
Update to `remix-toast` v3.4.0 or newer if you intend to use a `duration` of zero to control toast visibility programmatically without auto-hiding.
Ensure `getToast` and `unstable_toastMiddleware` are imported from `remix-toast/middleware` and not directly from `remix-toast`.
Upgrade your `react-router` dependency to v7 or higher, or downgrade `remix-toast` to v1.x if you're stuck on an older `react-router` version.
Use ESM `import` statements for `remix-toast` as it's designed for modern Remix projects which are typically ESM. If forced to use CJS, configure your build system to transpile or adjust imports accordingly.