There are 3 livewire components UserIsExpired
, UserIsActive
and UserIsPending
and 3 buttons respective to each component. When a button is clicked, it should replace previous component with its respective component.
<button wire:click="$emit(active)">{{ __('Active') }}</button>
<button wire:click="$emit(pending)">{{ __('Pending') }}</button>
<button wire:click="$emit(expired)">{{ __('Expired') }}</button>
In view
<livewire:user-is-active :active="$active"/>
<livewire:user-is-pending :pending="$pending"/>
<livewire:user-is-expired :expired="$expired"/>
Component example
class UserIsExpired extends Component
{
protected $listeners = ['expired'];
public function render()
{
return <<<'blade'
<div>
{{-- The best athlete wants his opponent at his best. --}}
</div>
blade;
}
}
When Active
button is clicked, it should load UserIsActive
component. Same goes for other two.
I have been looking livewire doc for long, but unable to find how to make it happen. Thanks in advance.