Inertia.js is an approach that allows you to build single-page applications (SPAs) using server-side rendering and traditional server-side routing. In other words, it allows you to build SPAs using just PHP (Laravel), Ruby (Rails), or any other server-side language, and client-side framework such as React, Vuejs without worrying about maintaining two different repository, two different domain to host backend and frontend separately.
Inertia has no client-side routing, nor does it require an API. Simply you can build controllers and page views in easier way.
One of the easiest methods to get started with React/Vue, Inertiajs and Laravel is by installing Laravel/breeze scaffolding:
- Start a Laravel Project
composer create-project laravel/laravel laravel-inertia-react
- Install laravel/breeze in your laravel project.
composer require laravel/breeze --dev
- Then install the frontend scaffolding as per your desire
php artisan breeze:install vue
# Or...
php artisan breeze:install react
php artisan migrate
npm install
npm run dev
- Run server to view the Laravel/breeze default authentication scaffolding.
php artisan serve
Note: Inertia is not appropriate for those who value SEO, even though inertia make life easier to integrate frontend and backend.
Useful links: Inertiajs, Laravel-breeze
If you liked this post please leave a reaction/comment.
Read More in BlazeCodes.com
Top comments (0)