Radio Button Auto Switching If Value Get From Database

I have 5 grouped radio buttons, then the values ​​of the radio buttons are dynamic, foreach and fetched from the database.

But the problem is the auto switching radio button, what do you think about it?

Livewire Version : 2.x
Laravel Version : 8.x

screenshots or code examples:

Controller
class Example {
public $answer = [];
}

Blade

<li><input type="radio" wire:model='answer.{{ $item->id }}' value='{{$item->key}}' name="answer.{{ $item->id }}"> <span style="margin-left:10px;">A. {{ $item->opsi_a }}</span></li>
<li><input type="radio" wire:model='answer.{{ $item->id }}' value='{{$item->key}}' name="answer.{{ $item->id }}"> <span style="margin-left:10px;">B. {{ $item->opsi_b }}</span></li>
<li><input type="radio" wire:model='answer.{{ $item->id }}' value='{{$item->key}}' name="answer.{{ $item->id }}"> <span style="margin-left:10px;">C. {{ $item->opsi_c }}</span></li>

Add ID to each button. It will probably resolve your issue.

Can you show example of the code?

something like this:

<input type="radio" id="radio-{{ $item->id }}" wire:model='answer.{{ $item->id }}' name="answer.{{ $item->id }}">

Oh wait. You have mapped all radios to the same models and names. You need to have unique names in order to have possibility change them independently.