namespace App\Http\Livewire;
use Livewire\Component;
class TestComponent extends Component
{
public $title ="hy i am";
public function change()
{
$this->title = 'changed';
}
public function render()
{
return view('livewire.test-component')->layout('layouts.app');
}
}
the mentioned above is a simple function code just for while clicking want to change the message
@migsAV i didnot understand "Then in your blade file" i just showed as two part/methods on the first method it is working correctly and on the second method while calling with @yield('content') it is not working or the button is not triggering
The first method works because you are using the component <livewire:test-component/> which has the <button wire:click="change">Click Me</button> in it and makes the call back to your Livirewire component class TestComponent extends Component.
The second method you only have <button wire:click="change">Click Me</button> which is not aware of you component class TestComponent extends Component
@migsAV ok so,how should i want to change my code!..can you please get me a example code snippet
why because we cannot prepare layouts for each function right?