Interacting With Livewire From Alpine

my code:
in my livewire file:
public $type = ‘this is my type’;

{{$type}} // works: this is my type

//didnt work

its didnt work i get

$wire is not defined

alpine 2.7
livewire 2 (i was use v1 but after update to 2 still didnt work)

when i try to use
$wire.type

its didnt work

What exactly want to do here?

cause your question is not clear enough and of course there is no $wire variable here

if you want to use Livewire attribute use wire:your-evet
if you want to use alpineJs attribute use x-your-event

i found the solution

alpine has been loaded before livewire. (in layout page)

I’m having the same problem with $wire not being defined… but isn’t the recommended setup to load the livewire scripts right before the close of the body tag, and have alpine pulled in at the head? I do have ‘defer’ set on the alpine script, but still experiencing the issue.

This is happening to me in one view but not the other. The only difference between the two is that on the working one, I’m loading the livewire component directly, whereas in the non-working version, I’m returning a blade view then adding the livewire component to the view.

I’ve narrowed it down to it working in one of my blade layouts and not the other. They seem almost identical, I don’t see yet what’s causing the difference.

Ugh. Found the issue. If I’m not mistaken, out of the box jetstream used an outdated version of alpine on the guest layout, but used the up-to-date version on the app layout.