Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
Displaying react js component in laravel 8 view doesn't work

I'm using laravel 8 for backend and react js for frontend . After the call of "app.js" in the view script "index.blade.php" to display "example" component, nothing is shown ... Here's my code :

Example.js

import React from 'react';
import ReactDOM from 'react-dom';

function Example() {
    return (
        <p>HEYYY THIS IS ME</p>
    );
}

export default Example;

if (document.getElementById('example')) {
    ReactDOM.render(<Example />, document.getElementById('example'));
}

index.blade.php :

@extends('layouts.app')
@section('content')

 
 <div id="example">
   
  <script src="{{ asset('js/app.js') }}"></script>
  </div>
 
 @endsection

web.php:

/* ... */
Route::get('/', function () {
    return view('index');
})->where('/', '[^admin]*');
/* ... */

app.js :

require('./bootstrap');
require('./components/Example');

I think the call of app.js is correct because when i inspect it shows

<div id="example">
<script src="http://127.0.0.1:8000/js/app.js"></script>
</div>  
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!