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!' ]); } }

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

<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.
Was this page helpful?