Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bi3_dev's avatar

Is Livewire supposed to do this ?

I am relatively new to livewire and I am working with livewire 3. Upon inspecting the page it seems livewire is printing this:

<div wire:snapshot="{&quot;data&quot;:[],&quot;memo&quot;:{&quot;id&quot;:&quot;V5Kw1G2pWh0MO2lLmnJz&quot;,&quot;name&quot;:&quot;home&quot;,&quot;path&quot;:&quot;home&quot;,&quot;method&quot;:&quot;GET&quot;,&quot;children&quot;:[],&quot;errors&quot;:[],&quot;locale&quot;:&quot;en&quot;},&quot;checksum&quot;:&quot;1b6ba5185469ff0965ae3211ea15af316e047bc1d52aa7179973e3338ea08cc0&quot;}" wire:effects="[]" wire:id="V5Kw1G2pWh0MO2lLmnJz">

    <div class="text-5xl text-white">
        Welcome Developer
    </div>
</div>

I have following code in resources\views\components\layouts\app.blade.php

<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

    <head>
        <meta charset="utf-8">
        <meta
            name="viewport"
            content="width=device-width, initial-scale=1"
        >
        <meta
            name="csrf-token"
            content="{{ csrf_token() }}"
        >

        <title>{{ config('app.name', 'Laravel') }}</title>

        {{-- Fonts --}}
        <link
            href="https://fonts.bunny.net"
            rel="preconnect"
        >
        <link
            href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap"
            rel="stylesheet"
        />

        {{-- Scripts --}}
        @livewireStyles
        @vite(['resources/css/app.css', 'resources/js/app.js'])
    </head>

    <body class="bg-slate-900/90 font-sans antialiased">

        {{-- Page Content --}}
        {{ $slot }}

        @stack('scripts')
        @livewireScripts
    </body>

</html>

I followed the installation guide from: https://livewire.laravel.com/docs/installation Even when I remove the @livewireStyles and @livewireScripts it still shows the wire:snapshot on root div element. is this expected behaviour ? Is the wire:snapshot supposed to be printed ?

0 likes
3 replies
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

Yes, the wire:snapshot attribute is expected to be printed in the root div element when using Livewire. It is used to store the initial state of the component and is necessary for Livewire to work properly.

If you don't want the wire:snapshot attribute to be printed, you can remove it by modifying the Livewire configuration. In your config/livewire.php file, you can set the snapshot option to false:

'snapshot' => false,

This will prevent the wire:snapshot attribute from being printed in the HTML output.

However, keep in mind that removing the wire:snapshot attribute may cause some functionality to break, as it is used by Livewire to initialize the component's state. So, make sure to test your application thoroughly after making this change.

1 like

Please or to participate in this conversation.