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

jpmg's avatar
Level 13

laravel livewire not render

good morning

I have a problem with livewire, i have a main blade call home it has all the css and js and i have a principal div so all my page will load in my principal div, the problem the i have is the my livewire doesn't render any help???

Main blade. (home.blade.php)

                  <html>
						<head>
								...
								@livewireStyles
						</head>
						<body>
								<div id='content' class="col-12" ></div>
								@livewireScripts
						</body>
					</html>
	

function to call all pages. (js)

				window.User = function () {
 								$.ajax({
     										url:  "user_blade",
     										type: "GET", 
     										success: function(data){
      										$('#content').html(data).fadeIn();    
    										},
   											 beforeSend: function(){
      										$('#content').empty()
    										},
   										});
				}

my user blade (user.blade.php)

				@livewire('create-casa')

my livewire blade (create-casa.blade.php)

			<div style="text-align: center">
					<button type="button" wire:click.prevent="sumar()" class="btn btn-primary">Save 		
						changes</button>
					<h1>{{ $count }}</h1>
			</div>

my livewire Class (CreateCasa.php)

				<?php

				namespace App\Http\Livewire;
				use Livewire\Component;

				class CreateCasa extends Component {
				public $count = 1;

				public function sumar() {
				$this->count++;
			}

				public function render() {
				return view('livewire.create-casa');
			}
		}

this is my code the problem the i have is the livewire doesn't render, but if i put all the code in the main blade it works, any help??

0 likes
9 replies
tykus's avatar

function to call all pages. (js)

What is this all about?

jpmg's avatar
Level 13

I have a javascript file (pages.js) were i call all my pages in the project

tykus's avatar

What is happening with the browser's history state when you're fetching page content like this?

Also, if this is your approach, why not just use Livewire to render your pages?

jpmg's avatar
Level 13

VM8638:3 Livewire: It looks like Livewire's @livewireScripts JavaScript assets have already been loaded. Make sure you aren't loading them twice.

DevTools failed to load source map: Could not load content for http://127.0.0.1:8000/livewire.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

I dont't know how to render my main blade with livewires.

Snapey's avatar

you are going to have to find a way to re initialise livewire each time you swap out the body

But as has been pointed out, why not use livewire for the whole page and use child components

bestiony's avatar

@JefersonKasper you're a lifesaver, I had this problem and it turned out I had php8.2 in my local machine and PHP 8.1 in server. any livewire component that uses view('view_name')->extend('layout_name') were rendered empty white pages with some text thanks for the tip

Please or to participate in this conversation.