Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Rendering on the browser with react

i am confused i open the index.html file without setting up any local server and everything renders on the screen however,when i set up the local server it doesnt work and just a blank page and that shouldnt happen any help please

Adam Beer
Adam Beer
11,314 Points

Please show your whole code.

Code

Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting.

      ```html
      <p>This is code!</p>
      ```
const title=React.createElement(
    'h1',
    {id:'main-title',title:'This is a title.'},
    'My First React Element!'
);
const desc=React.createElement(
    'p',
    null,
    "am a React Developer!"
);
const header=React.createElement(
    'header',
    null,
    title,desc
);

ReactDOM.render(
header,
document.getElementById('root')
);

in the video guil is running on local host and uses CDNs from react.org

Adam Beer
Adam Beer
11,314 Points

Mark where you are in the course and then I can check the video.

Adam Beer i think i figured it out but another proplem pooped up that whenever i change or update anything in my code it doesnt reflect on the server (old output only before changing code)

Adam Beer
Adam Beer
11,314 Points

Bravo! Please share where are you in the course, so which video are you watching? Sorry, but if I didn't see Guil whole code, I can't find the fault.

1 Answer

Adam Beer
Adam Beer
11,314 Points

Your React code is good! Maybe the issue has in your HTML file.