SSR & Server Actions Integration
Patterns for pairing Next.js App Router Server Actions with toastory client feedback.
toastory is built from the ground up to be 100% SSR-safe. Core state stores and logic run in pure Node without accessing window or document at import time.
Calling Toast from Server Action Transition
import { useTransition } from 'react'; import { toast } from 'toastory'; import { updateAccountAction } from './actions';
export function ProfileForm() { const [isPending, startTransition] = useTransition();
const handleSubmit = (formData: FormData) => { startTransition(async () => { const res = await updateAccountAction(formData); if (res.success) { toast.success('Profile updated successfully!'); } else { toast.error('Update failed', { description: res.error }); } }); };
return (
); }`Want to test these options live?
Launch the interactive playground to experiment with themes, positions, and live generators.