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

323
Views
Why does ReactJS component, which is a function, have to be put in inside tags at the ReactDom.render() method?

I am very very new to ReactJS and JavaScript in general, so I am having difficulty trying to make sense of the syntax.

I have the following very basic component:

import React from 'react'
import ReactDom from 'react-dom'

function Greetings()
{
  return <h1>Hello World</h1>
}

which I am trying to render using the below line:

ReactDom.render(<Greetings/>, document.getElementById('root'))

Now I am having difficulty trying to make sense of the syntax:

ReactDom.render(<Greetings/>, document.getElementById('root')), where Greetings() is a function.

So what does enclosing it in tags mean ?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The syntax is called JSX. By using JSX, you are effectively calling React.createElement(). So, if you don't want to use JSX (<Component>), you can replace it with React.createElement(Component). In fact, this is what Babel does when you use React: replaces all JSX tags with calls to React.createElement.

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!