Laravel React Jsx Starter Kit

JavaScript

Production-ready Laravel 13 starter kit with React 19, Inertia.js v3, Vite, Tailwind CSS v4, SSR support, and powerful Artisan generators for scalable applications.

Stars
18
Forks
1
Downloads
4,326
Open Issues
1
Files main

Repository Files

Loading file structure...
resources/js/hooks/use-flash-toast.js
import { router } from '@inertiajs/react';
import { useEffect } from 'react';
import { toast } from 'sonner';

export function useFlashToast() {
    useEffect(() => {
        return router.on('flash', (event) => {
            const flash = event.detail?.flash;
            const data = flash?.toast;

            if (!data) {
                return;
            }

            toast[data.type](data.message);
        });
    }, []);
}