© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
18 replies
Pints

Livewire Component passing variable to Blade Error

Hello! I have a livewire component called Announcement and this is the code

<?php

namespace App\Http\Livewire;

use Livewire\Component;

class Announcement extends Component
{
    public $message = '';

    public function render()
    {
        return view('livewire.announcement', [
            'message' => 'This is a test announcement!'
        ]);
    }
}

<?php

namespace App\Http\Livewire;

use Livewire\Component;

class Announcement extends Component
{
    public $message = '';

    public function render()
    {
        return view('livewire.announcement', [
            'message' => 'This is a test announcement!'
        ]);
    }
}


This is my blade file's code in /views/livewire/announcement.blade.php

<div>
    <div>
        <h1>Announcement</h1>
        <h1>{{ $message }}</h1>
    </div>
</div>
<div>
    <div>
        <h1>Announcement</h1>
        <h1>{{ $message }}</h1>
    </div>
</div>


I tried a lot of things of why the error message "Undefined variable $message" is always showing but I can't seem to find what solution is applicable.
image.png
Solution
I got it working bro, the solution is I deleted the Announcement Class and its View file and created a new livewire component.
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Livewire component in blade template
FilamentFFilament / ❓┊help
2y ago
Livewire component has 'undefined variable' after updating Livewire?
FilamentFFilament / ❓┊help
3y ago
Blade Component
FilamentFFilament / ❓┊help
12mo ago
How to passing value from a stateUpdated to Livewire component
FilamentFFilament / ❓┊help
2y ago