Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 894 Bytes

File metadata and controls

40 lines (33 loc) · 894 Bytes

React Exercise - Recursion

This is a template app for React Exercise.

How to start the application

  • yarn install
  • yarn start

Instructions

Write a React component, that receives array of React Component classes (e.g. "One", "Two", "Three") as prop, then recursively renders HTML with those components:

<One>
  <Two>
    <Three>
    </Three>
  </Two>
</One>

Let the produced html be as followed:

<div class='App-box'>
  One
  <div class='App-box'>
    Two
    <div class='App-box'>
      Three
    </div>
  </div>
</div>

Files that should be edited:

  • src/recursion/Recursion.js
  • src/recursion/RecursiveComponent.js

Do not edit any other files.

Bonus exercise

Modify your One, Two and Three components, so they don't re-render on every timer tick. RecursiveComponent can re-render, but each component in recursive function shouldn't.