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

181
Views
Why doesn't my Hello World work in react?

Can you please tell me where is the bug in this code?

index.html:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
    <script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script> 
    <script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>
    <script src="main.js" type="text/babel"></script>
  </head>
  <body>
        
    <div id="app"></div>

   
  </body>
</html>

main.js:

ReactDOM.render(<h1>Hello World</h1>, document.getElementById("#app"));
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You do NOT need the hash symbol (#) when using document.getElementById. That is only required when using document.querySelector

ReactDOM.render(<h1>Hello World</h1>, document.getElementById("app"));
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="app"></div>

about 4 years ago · Juan Pablo Isaza Report

0

Actually you don't need to append # in document.getElementById so it will become: ReactDOM.render(<h1>Hello World</h1>, document.getElementById("app"));

about 4 years ago · Juan Pablo Isaza Report
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!