livewire / volt

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

Volt documented example showing error #99

Closed joydeep-bhowmik closed 7 months ago

joydeep-bhowmik commented 7 months ago

Volt Version

1.6.2

Laravel Version

10.10

PHP Version

8.2.12

Database Driver & Version

No response

Description

<?php

use function Livewire\Volt\{state};

state('count');

$increment = function () {
    // Store the new count value in the database...

    $this->count++;
};

?>

<x-app-layout>
    <x-slot name="header">
        Initial value: {{ $count }}
    </x-slot>

    @volt('counter')
        <div>
            <h1>{{ $count }}</h1>
            <button wire:click="increment">+</button>
        </div>
    @endvolt
</x-app-layout>

This example returns Undefined variable $count for Initial value: {{ $count }}

Steps To Reproduce

just install volt 1.6.2 and use the mentioned example

driesvints commented 7 months ago

Just works for me.

joydeep-bhowmik commented 7 months ago

Just works for me.

any possible reason it's not working for me? I did clear the compiled views My livewire version: 3.4 My volt version:1.6.2

I installed volt with breeze


  <x-slot name="header">
        Initial value: {{ $count }}
    </x-slot>

This $count variable is returning undefined not the $count variable inside volt directive

kemalozvarol2 commented 3 days ago

Same error happening with me too. Have you found a solution?

Versions : livewire/livewire : ^3.5 (v3.5.9) livewire/volt : ^1.6 (v1.6.5) laravel/framework : ^11.9(v11.26.0)

joydeep-bhowmik commented 2 days ago

Same error happening with me too. Have you found a solution?

Versions : livewire/livewire : ^3.5 (v3.5.9) livewire/volt : ^1.6 (v1.6.5) laravel/framework : ^11.9(v11.26.0)

nope still no solution to this ... seems like livewire variables are only available within volt directives