React component does not render - Front End Development Libraries Projects - Build a Markdown Previewer

Tell us what’s happening:
I am trying to put some React in the JavaScript, however the React component does not render, even though I’ve included the necessary packages. I tried to render the React component using the line

ReactDOM.render(<MyComponent />, document.getElementById('root'));

however it did not render the desired output.
In the output window, I would expect to see “freeCodeCamp” with heading 1 formatting, but the text does not even appear.
The JavaScript code that I included is based on the “Render State in the User Interface” challenge as I know that this code works.
Thank you in advance for any help you can offer.

Your code so far
Linked in another post.

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/115.0

Challenge: Front End Development Libraries Projects - Build a Markdown Previewer

Link to the challenge:

Link to the code:

You can’t import React like that. Use the Codepen JS settings.

  1. Move the rendering code down into the JS section at the bottom of the code.

  2. Remove everything in the HTML section and add a single element with the root id.

  3. Add the React imports to the JS section at the top.


<div id="root"></div>


import React from ''
import ReactDOM from ''

class MyComponent extends React.Component {
  constructor(props) {
    this.state = {
      name: 'freeCodeCamp'
  render() {
    return (
        { /* Change code below this line */ }
        { /* Change code above this line */ }

ReactDOM.render(<MyComponent />, document.getElementById('root'));

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.