React - Render a Class Component to the DOM

Tell us what’s happening:
I can’t figure out why this isn’t working. The syntax seems correct. Halp!

I get this error “Uncaught TypeError: document.getElementByID is not a function”

Your code so far

class TypesOfFood extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <div>
        <h1>Types of Food:</h1>
        {/* Change code below this line */}
          <Fruits />
          <Vegetables />
        {/* Change code above this line */}
      </div>
    );
  }
};

// Change code below this line
ReactDOM.render(<TypesOfFood />, document.getElementByID("challenge-node"));

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: React - Render a Class Component to the DOM

Link to the challenge:

As the error says, the document object does not have a function named getElementByID. Perhaps you meant to use this one?

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