Typing into answer space causes RAM usage to escalate and tab crashes

Tell us what’s happening:
The moment I paste <TypesOfFood /> into the second blank, Chrome RAM amount goes up to 3800 MB, then the tab dies for not enough memory.

Your code so far


const TypesOfFruit = () => {
  return (
    <div>
      <h2>Fruits:</h2>
      <ul>
        <li>Apples</li>
        <li>Blueberries</li>
        <li>Strawberries</li>
        <li>Bananas</li>
      </ul>
    </div>
  );
};

const Fruits = () => {
  return (
    <div>
      { /* change code below this line */ }
  <TypesOfFruit />
      { /* change code above this line */ }
    </div>
  );
};

class TypesOfFood extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <div>
        <h1>Types of Food:</h1>
        { /* change code below this line */ }

        { /* change code above this line */ }
      </div>
    );
  }
};

Your browser information:

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

Link to the challenge:
/front-end-libraries/react/use-react-to-render-nested-components/

You are recursively rendering <TypesOfFood/> inside of <TypesOfFood/>. You should be adding <TypesOfFruit/> instead.

1 Like

Oh yeah, how could I’ve not realized. I’m closing this thread now, thanks a lot!