Kritim Yantra
Mar 27, 2025
Laravel 12 offers flexible options for frontend development with JavaScript frameworks like React. The primary methods include leveraging starter kits for new projects, which incorporate Inertia.js for a seamless SPA experience, and using the laravel/ui
package for existing projects, which provides a more traditional setup. The choice depends on project needs, with Inertia.js being the modern, recommended approach for new developments due to its integration benefits.
If you're starting fresh, the easiest way is to use Laravel's React starter kit, which includes Inertia.js for smooth integration.
composer global require laravel/installer
laravel new my-app
cd my-app
npm install
npm run build
composer run dev
http://localhost:8000
to see your React frontend integrated with Laravel via Inertia.js.shadcn/ui
components, found in resources/js/components/
.If you already have a Laravel 12 project, you can add React using the laravel/ui
package.
composer require laravel/ui
php artisan ui react
php artisan ui react --auth
npm install
npm run dev
resources/js
.welcome.blade.php
.Feature | React Starter Kit (New Projects) | Laravel/UI (Existing Projects) |
---|---|---|
Inertia.js Integration | Yes, included by default | No, manual setup required |
Authentication | Laravel Breeze, pre-configured | Optional via --auth flag |
Tooling | Vite, Tailwind, TypeScript | Vite, basic React setup |
Recommended For | New SPAs, modern development | Legacy projects, simple setups |
Setup Complexity | Moderate, guided by installer | Simple, command-based |
laravel/ui
is still a viable option.An unexpected aspect for many users is the reliance on Inertia.js in the starter kit, which differs from traditional React setups where a separate API is common. This integration allows Laravel routes and controllers to directly serve React components, simplifying development but requiring familiarity with Inertia's ecosystem.
😀🚀🎨
laravel/ui
provides a simple React setup without Inertia.js but is considered a legacy approach.No comments yet. Be the first to comment!
Please log in to post a comment:
Continue with Google