document.addEventListener('livewire:load', function () {
// Call the livewire increment method in javascript
@this.increment()
})
@this.set('key', 'value');
<script>
let posts = @js($posts)
// "posts" will now be a JavaScript array of post data from PHP.
</script>