Laravel and Livewire conflict, Livewire wire:click don't work on Laravel 8.

Updated: Feb 08, 2025

Laravel and Livewire conflict, Livewire wire:click don't work on Laravel 8.

When using Laravel 8 and Livewire together, you might encounter some issues with Livewire's wire:click directive not working as expected. This issue can be caused by a few different things, and in this answer, we'll go over some potential solutions to help you get your wire:click events working again.

First, let's make sure that you have installed both Laravel and Livewire correctly. To use Livewire with Laravel, you need to install it via Composer:

composer require livewire/livewire

After installing Livewire, you should register the Livewire service provider in your app/Providers/AppServiceProvider.php file:

use Livewire\Livewire;

class AppServiceProvider
{
    public function boot()
    {
        Livewire::component('components.example');
    }
}

Now, let's talk about the wire:click directive not working. One common cause of this issue is that you might be using an older version of Livewire that is not compatible with Laravel 8. To check your Livewire version, run the following command:

composer show livewire/livewire

If you see a version lower than 2.0.0, you should update Livewire to the latest version:

composer require livewire/livewire:^2.0

Another potential cause of the wire:click not working issue is that you might be using Laravel's default Blade compiler instead of Livewire's compiler. Livewire uses a different compiler to process its directives, so you need to make sure that you're using Livewire's compiler.

To use Livewire's compiler, you need to publish its configuration file and set the blade.compilers array in your config/app.php file:

'providers' => [
    // ...
],

'aliases' => [
    // ...
],

'app' => [
    // ...
],

'components' => [
    'vendor' => [
        'Livewire\\Livewire' => 'livewire/livewire',
    ],
],

'view' => [
    'finders' => [
        'components' => [
            'Livewire\\View\\ComponentFinder',
        ],
    ],
],

'blade' => [
    'compilers' => [
        'components' => [
            'Livewire\\Blade\LivewireBladeCompiler',
        ],
    ],
],

After making these changes, you should be able to use Livewire's wire:click directive in your Laravel 8 application.

If none of the above solutions work for you, you might want to consider reaching out to the Livewire community for further assistance. You can join their Discord server or post a question on their GitHub repository.