Livewire

$wire.$js Syntax Changes in Livewire v4

February 01, 2026 1 min read 15 views

Livewire v4 introduces a cleaner syntax for $wire.$js.

Before (v3 - Deprecated)

$wire.$js('bookmark', () => {
    // Toggle bookmark...
});

// Or
$js('bookmark', () => {
    // Toggle bookmark...
});

After (v4)

$wire.$js.bookmark = () => {
    // Toggle bookmark...
};

// Or in component
this.$js.bookmark = () => {
    // Toggle bookmark...
};

Benefits

- Cleaner object-style syntax
- More intuitive naming
- Better IDE support
Share this post:

Related Posts

Comments (0)

Please log in to leave a comment. Log in

No comments yet. Be the first to comment!