Why is it not needed to render components to the React's DOM?

Tell us what’s happening:.
Hi everyone!
I’ve looked at the solution for this example:

  1. We declared a const List that is taking props as an argument.
  2. We created a class ToDo component that has tasks arrays.
  3. We then passed tasks as props argument to the List.
    I get the above.
    In some cases we must render components to the React’s DOM (using ReactDOM.render command).
    In cases like this one, we don’t do that.

I am confused-when must we render components to the React’s DOM?
Thanx!

Your code so far


const List = (props) => {
{ /* change code below this line */ }
return <p>{}</p>
{ /* change code above this line */ }
};

class ToDo extends React.Component {
constructor(props) {
  super(props);
}
render() {
  return (
    <div>
      <h1>To Do Lists</h1>
      <h2>Today</h2>
      { /* change code below this line */ }
      <List/>
      <h2>Tomorrow</h2>
      <List/>
      { /* change code above this line */ }
    </div>
  );
}
};

Your browser information:

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

Challenge: Pass an Array as Props

Link to the challenge:

It’s normally only used once in a React application. It’s not present because it doesn’t need to be for the lesson: you’re not building a whole app. Plus ReactDOM is a seperate library, there’s only React code there

It isn’t for rendering to React, it’s for rendering the React app to the DOM, ie make the end result appear in a browser.

1 Like

Thanks for the detailed answer. I appreciate it.