State of multiple toggle buttons
I have multiple dynamically generated toggle buttons, I need to get the state of all of the toggle buttons that are selected. Using afterStateUpdated I can only get the state of the current selected toggle button but I need to know the state(selection) of any other toggled buttons. Anything else I can pass to the function?
->afterStateUpdated(function (Set $set, Component $component, ?string $state)
2 Replies
$livewire, can probably get the data from that. Or access it from the $component->getLivewire()
thanks @awcodes I will look into livewire, I'm still newish to livewire, will also try getLivewire()
That did it, thank you @awcodes
->afterStateUpdated(function (Set $set, Component $component, ?string $state) {
$livewireComponent = $component->getLivewire();
// Extract the data array
$data = $livewireComponent->data;