import React from ‘react’;
import ReactDOM from ‘react-dom’;
ReactDOM.render(
Hello world
, document.getElementById(‘app’));What does ‘app’ represent?
import React from ‘react’;
import ReactDOM from ‘react-dom’;
ReactDOM.render(
What does ‘app’ represent?
its an html element with an id of app
, to which we render the result
the element could be anything, its very like a divider (div)
Do we always use ‘app’ or here only we are using ‘app’ because there is a hidden HTML element with id=‘app’?
html elements are never hidden, there might be naming conventions, but i doubt there a strict rules.
if you don’t know html and JS, i would start there, don’t start with reactJS
Actually, I am not able to understand this code
import React from ‘react’;
import ReactDOM from ‘react-dom’;
// Copy code here:
ReactDOM.render(
When i run this code, it shows Hello World on the output screen and i am not getting why is this happening because there was no html element with id=‘app’
there must be, otherwise nothing would be rendered
html code has to be written within a html file, did you check the html file? It should be there, as should the element with id
if you don’t know html and JS, don’t proceed with this course, learn JS and html first
Got you. I am fimilar with HTML and Js. Actually i am new to Codecademy…Found index.html now…Thanks for the help!