Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Laravel 11 with Inertia.js and React | A Practical Guide
Rating: 4.5 out of 5(57 ratings)
404 students

Laravel 11 with Inertia.js and React | A Practical Guide

The ultimate guide to build Single Page Applications with Laravel 11, React, and Inertia | Build Practical Projects
Created byTapan Sharma
Last updated 3/2025
English

What you'll learn

  • Learn how to Build Single Page Applications using Laravel 11, Inertia and React
  • Learn how to Implement Roles and Permissions on an Inertia based App (Without using any external package)
  • Learn how to Build dependent dropdowns in Laravel and React
  • Learn how to Build Data-tables using Laravel, Inertia and React
  • Learn how to Implement Translations in an Inertia based app.
  • Learn how to implement Infinite Scrolling in Inertia Based Applications
  • Learn how to Customize Error Pages in Inertia

Course content

8 sections81 lectures11h 24m total length
  • Introduction3:47

    Install and set up Laravel with Inertia and the React stack, define pages and Inertia responses, and handle forms, validations, and partial reloads with data as props.

  • Install and Setup Laravel/Inertia.js with React4:14
  • Overview of the Project11:06

    Inspect a fresh Laravel project with Inertia and Breeze, register a user, and observe profile updates and navigation without page refresh via Inertia.

  • Creating Pages4:59

    Learn to create pages with Inertia in a Laravel 11 app by defining authenticated resource routes, rendering a posts index component, and updating navigation and assets with npm run dev.

  • Title and Meta Tags4:20

    Learn to set the title and meta tags for Inertia.js pages using the head component, pass description meta data, and enable server-side rendering for production SEO.

  • Passing Data to Pages8:56

    Define a post model, migration, factory, and seeder, and set up the user relation. Fetch posts, pass them to the front end as props, and render bodies with unique keys.

  • Swapping to API Resources9:49

    Swap to API resources in Laravel to format post data and conditionally include user data only when eager loaded, preventing N+1 queries, using post and user resources.

  • Form Basics14:43
  • Submitting Forms6:40

    Apply server-driven validations with a store post request, enforce the body field for authenticated users, display errors, store posts, and redirect back with a cleared form.

  • Resetting Forms3:49

    Use the useForm helper to reset the form after a successful post, optionally resetting specific fields like body, and implement two-way binding with the text area.

  • Clearing Validation Errors4:32

    Clear validation errors when focusing the text area by calling the use form helper's clear errors for body, and wrap the call in an anonymous function to prevent rerenders.

  • Accessing Form Processing State2:58

    Access the forms processing state to prevent multiple submissions by disabling the submit button during a request. Apply conditional classes based on processing, such as opacity 50.

  • Manual Visits and Partial Reloads10:16

    Learn how to implement manual visits and partial reloads with Inertia.js to refresh only post data, preserve scrolling, and use router.get or router.visit for targeted updates.

  • Partial Visits (and more) with Links3:10

    Implement manual visits and partial reloads using inertia's link component in a Laravel 11 with inertia.js and React app; preserve scroll and selectively load post data.

  • Shared Data3:44

    Share data globally from the back end with inertia middleware to support roles, permissions, and authorization checks across all pages, exposing a greeting Hello World as a front-end prop.

  • Making Use of Ziggy3:45

    Discover how Ziggy exposes Laravel routes to the frontend, enabling route name references in JavaScript to improve maintainability and developer experience.

  • Hooking into Forms for Flash Messages6:09

    Hook into Inertia's router to display flash notifications after post requests using React Hot Toast, configure a toaster, and show a top-right success message when a post is created.

  • Revisiting Shared Data for Better Flash Messages9:30

    Drive flash messages from the backend in a Laravel 11 app using Inertia.js and React by emitting a session message and watching it on the frontend to trigger a toast.

  • Shorthand Routes1:53

    Explore shorthand routes in inertia to render front-end components directly, mirroring Laravel's route view, with middleware and route name preserved when passing the component.

  • Remembering Form States3:13

    Learn how to remember form states in inertia by using a unique form id with use form, so inputs retain data when navigating between pages, improving UX.

  • Preserving States2:44
  • Basic Authorization12:30

    Implement a basic authorization in inertia apps by enabling post creation only for users with verified emails. Laravel 11 auto-discovers this policy and applies checks on backend and frontend.

Requirements

  • Beginner Level knowledge of PHP/Laravel is required
  • Beginner Level knowledge of React is required

Description

In this course, we will be Learning Inertia.js (A tool to build single-page apps, without creating any APIs)  along with React.js in a practical way by building multiple practical projects along the way.


Inertia serves as the solution, seamlessly connecting Laravel as a backend with a frontend Framework (React/Vue/Svelte), enabling us to build everything in one application (a monolith) while achieving the same outcome. The best part? We don't have to create an API.


Projects Roadmap and Status:

[Uploaded] Learn Inertia

[Uploaded] Flexible Flash Notifications with Inertia

[Uploaded] Customizing Error Pages in Inertia

[Uploaded] Building a Simple Student's Management System

[Uploaded] Implementing Roles/Permissions in Inertia-Based Applications.

[Uploaded] Infinite Scrolling with Inertia

[Uploaded] Translations with Laravel and Inertia


Project Description:


[Uploaded] Learn Inertia

In this section, we'll look into the basics of Inertia and some of the fundamental features of Inertia.js.

Some of the topics we'll cover in this section include:


  • Learn how to set up Laravel with Inertia and React Stack.

  • Learn how to Format the data with API Resources.

  • Learn about how to work with forms, and display validation errors

  • Learn how to preserve the scroll behavior, and preserve the state of the page

  • Learn how to implement Manual Visits and Partial Reloads in Inertia.

  • Learn how to Implement Authorization checks (on both frontend and backend)

  • Learn how to Customize the default Error pages and render Custom Inertia Pages (403, 404, 419 pages)

  • Learn how to display Flash Notifications in Inertia/React

  • Learn how to Set up page titles and meta tags.


[Uploaded] Flexible Flash Notifications with Inertia


In this Section, we'll learn how to build a flexible flash notifications feature in Inertia.

By the end of the section, we'll have the ability to flash any type of notification, anywhere in our application, without repeating any code.


[Uploaded] Customizing Error Pages in Inertia

Learn how to Customize the default error pages in Inertia.

We'll learn the following in this Section:

  • Learn how to customize the default error pages in Laravel

  • Learn how to return an Inertia Response whenever any error is encountered in our app.

  • Learn how to render different types of errors by re-using the same React component.

  • Learn how to define a config to enable/disable the rendering of custom error pages


[Uploaded] Building a Simple Student's Management System

In this section, we'll build a simple CRUD app and dive into the fundamentals of building CRUD applications with Laravel, Inertia, and the React Stack, and we will learn the following topics along the way:


  • Learn how to Build dependent dropdowns in Inertia/React

  • Learn how to work with Factories and Seeders in Laravel, and seed the necessary data for all of our Models

  • Learn how to use a Re-usable React Component to display validation messages.

  • Learn how to Implement Server Side Pagination from scratch.

  • Learn how to Implement Search Functionality in an Inertia/React Data-table.

  • Learn how to Implement filters in an Inertia/React Data-table.


[Uploaded] Implementing Roles/Permissions in Inertia-Based Applications.

We'll continue from where we left off in the previous section and implement the Roles and Permissions functionality without using any external plugins.

Some of the features that we'll cover in this section are listed below:


  • Implement Roles CRUD.

  • Implement Authorization/Gate Checks throughout the project (on both frontend and backend)


[Uploaded] Translations with Laravel and Inertia

Localization is a breeze in Laravel applications, but what happens when you need to bring this to the client side? Turns out in Inertia, it's pretty simple.

In this section, we'll build a language switcher, share translations with the client, and build a simple translation helper to use directly in React components. We'll also cover caching translations to keep things running smoothly.


[Uploaded] Infinite Scrolling with Inertia

In this section, we'll seed our database with a bunch of data and start building the solution, we'll start by using Inertia's router to load additional data, and later we'll optimize the infinite scrolling flow by replacing the Router with Axios.

Who this course is for:

  • Students who want to Build Monolith(SPA) Applications using Laravel, InertiaJS and React