livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
327 stars 19 forks source link

[1.x] Adds SFC with Class API #15

Closed nunomaduro closed 1 year ago

nunomaduro commented 1 year ago

Note: This pull request seems to contain a lot of changes. However, most of them are simply new tests or moved tests to different folders.

This pull request makes it possible to build SFC with Livewire's class API:

<?php

use Livewire\Volt\Component;

new class extends Component {
    public $count = 2;

    function increment() {
        $this->count++;
    }
} ?>

<div style="text-align: center">
    <button wire:click="increment">+</button>
    <h1>{{ $count }}</h1>
</div>