I have two Apine components [app1, app2]
on change in app1
component storing the date value in Stores
and in app2
component trying to show the stored date value. it is not showing on update.
<script>
function app1(){
return {
date:'2023-07-23',
itenary:'',
}
}
Alpine.store('selected_itenary', app1().itenary);
</script>
<script>
function app2(){
return {
start_date:'2023-07-23',
}
}
</script>
<div x-data="app1()">
<input x-model="date" type="text" class="w-48">
<button class="rounded-md px-5 py-2 border border-gray-500" @click="$store.selected_itenary = date;">Click</button>
</div>
<div x-data="app2()">
<div x-text="$store.selected_itenary"></div>
</div>
How to bind store value in app2 component?
And also, is to correct/possible to bind only one Object entry to the store?
Alpine.store('selected_itenary', app1().itenary);