Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ctrlaltdelme's avatar

Can't get Livewire component to properly transmit its value

I have this like-input-modal component

<div>
    <label class="block text-sm text-primary-400 mb-1" wire:text="isLiked ? 'Liked' : 'Like'"></label>

    <div class="relative flex items-center group">
        <input type="hidden" name="is_liked" wire:model.live="isLiked"/>
        <div
            class="cursor-pointer relative"
            wire:click="toggleLike"
            wire:loading.class="opacity-50"
        >
            <x-icon-heart-outline
                class="w-10 h-10 hover:text-primary-400 transition-colors {{ $isLiked ? 'fill-primary-500 text-primary-500' : 'fill-none text-primary-500' }}"
            />

            <div wire:loading class="absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2">
                <svg class="animate-spin w-4 h-4 text-primary-500" xmlns="http://www.w3.org/2000/svg"
                     fill="none" viewBox="0 0 24 24">
                    <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
                    <path class="opacity-75" fill="currentColor"
                          d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
                </svg>
            </div>
        </div>
    </div>
</div>

I should be able to submit my form within review-modal

But when I submit the form, it's sending it across as false. But DebugBar and the DOM tell me it's true, so why is it not properly dumping as true?

0 likes
3 replies
Snapey's avatar

each component has its own state. You are expecting them to be bound together in some way?

ctrlaltdelme's avatar

@Snapey well when you put it that way 😂

I'm not sure what I need to do here though

Please or to participate in this conversation.