I am new in laravel livewire. I'm trying to set value of variable using livewire. In my livewire controller I have defined public variable.
public $baction;
in my livewire view is like this
<p>
Hello
{{$baction}}
</p>
<button wire:click="$set('baction', 1)" class="-ml-px relative inline-flex items-center">
Set
</button>
Now when I click on button it should set value of $baction
variable to 1 and it should show next to Hello text, but it's not showing.
Your code example works fine. I believe you forgot to include the livewire CSS and JS in the blade that displays your livewire component
<html>
<head>
.....
@livewireStyles
</head>
<body>
<livewire:my-awesome-component />
@livewireScripts
</body>
</html>