Laravel 11 Livewire 3 wire:navigate - Navigate Page

Websolutionstuff | Apr-09-2025 | Categories : Laravel

In this guide, I’ll show you how to use wire:navigate in Laravel 11 with Livewire 3 to switch pages without a full reload. It feels like a Single Page Application (SPA), but you don’t need Vue or React. Just Livewire.

I’ll walk you through it step by step with clean and simple code examples.

Laravel 11 Livewire 3 wire:navigate – Navigate Without Reload

Laravel 11 Livewire 3 wire:navigate – Navigate Without Reload

 

Prerequisites

Make sure you have:

  • Laravel 11 installed

  • Livewire 3 installed and configured

  • Routes and views ready

If you don’t have Livewire 3:

composer require livewire/livewire

Then add Livewire scripts to your layout:

<!-- In your main layout -->
@livewireStyles
@livewireScripts

 

Define Routes in web.php

use App\Livewire\Home;
use App\Livewire\About;

Route::get('/', Home::class)->name('home');
Route::get('/about', About::class)->name('about');

 

Create the Livewire Pages

php artisan make:livewire Home
php artisan make:livewire About

Update their render methods:

// app/Livewire/Home.php
public function render()
{
    return view('livewire.home');
}

// app/Livewire/About.php
public function render()
{
    return view('livewire.about');
}

 

Add wire:navigate Links in Blade

<!-- resources/views/livewire/home.blade.php -->
<div>
    <h1>Welcome to Home</h1>
    <a href="{{ route('about') }}" wire:navigate>Go to About Page</a>
</div>
<!-- resources/views/livewire/about.blade.php -->
<div>
    <h1>This is About Page</h1>
    <a href="{{ route('home') }}" wire:navigate>Back to Home</a>
</div>

That’s it. When you click the link, it navigates instantly without a full reload.

 

Add Active Link Style

You can use request()->routeIs() to highlight the active page.

<a 
    href="{{ route('about') }}" 
    wire:navigate 
    class="{{ request()->routeIs('about') ? 'text-blue-600 font-bold' : '' }}">
    About
</a>

 

Note:

  • wire:navigate only works on Livewire-powered pages.

  • Works best when your views are full Livewire components, not traditional Blade-only pages

 


You might also like:

Recommended Post
Featured Post
Laravel 9 Multiple Authentication Using Middleware
Laravel 9 Multiple Authenticat...

In this article, we will see laravel 9 multiple authentications using middleware. Using middleware we authenticate the u...

Read More

Apr-13-2022

How To Create Stacked Bar Chart In Laravel 9 Using Highcharts
How To Create Stacked Bar Char...

In this article, we will see how to create a dynamic stacked bar chart in laravel 9 using highchart. Here, we will...

Read More

Dec-30-2022

How To Create Candlestick Chart In Laravel 9 Using Highcharts
How To Create Candlestick Char...

In this article, we will see how to create a candlestick chart in laravel 9 using highcharts. A candlestick is a ty...

Read More

Oct-06-2022

How To Downgrade PHP 8 to 7.4 in Ubuntu
How To Downgrade PHP 8 to 7.4...

As a web developer, I understand the significance of embracing the latest technologies to stay ahead in the dynamic worl...

Read More

Aug-04-2023