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

95
Views
Adding react to html

I managed to understand how to add React to HTML, but faced a question. In tutorials I saw React is adding directly to HTML with 3 react scripts in head. In other I saw react is adding to JS file with import React from 'react' etc. When I connect js file in HTML, I write <script src="script.js" type="text/babel"></script> But if I didn't add those 3 scripts in head, but have import in js, nothing works. So, question is, how to add JS file with React with imports in js file, if it's possible.

Doesn't work with started >npx serve

Example of code that doesn't work: rh.html:

<!DOCTYPE html>
<html>
    <body>
        <div id="root"></div>

        <script src="rh.js" type="text/babel"></script>
    </body>
</html>

rh.js:

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

const element = (
    <table>
        <tr>
            <th>Name</th>
        </tr>
        <tr>
            <th>Age</th>
        </tr>
        <tr>
            <th>Region</th>
        </tr>
    </table>
)

ReactDOM.render(element, document.getElementById('root'));
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!