laravel livewire extract alpine data into function code example

Example 1: share data between livewire and alpine js

You can share data between livewire and apline js using : @entangle

class Counter extends Component
{
    public $showDropdown = false;
}

<div x-data="{ open: @entangle('showDropdown') }">
--------------- OR -----------------
<div x-data="{ open: @entangle('showDropdown').defer }">
  
With this you dont need to use wire model with that data Like
wire:model.defer="showDropdown"

Example 2: using laravel variable inside alpine js

<div x-data="{ showPanel: {{ $showPanel }} }"></div>