title: Implementing tree data structure for frontend components
body: <p>I'm trying to plan out a simple web app. A user is presented with a question that has two or three possible answers. Depending on their answer, they're taken to another question.</p>
  
  <p>i.e.</p>
  
  <pre><code>                                            ChoiceC
                 ChoiceA ---&gt; Question 2 ---&gt; ChoiceD
  Question 1 --&gt;                              
                 ChoiceB ---&gt; Question 3 ---&gt; ChoiceE
                                              ChoiceF
  
  </code></pre>
  
  <p>This seems to me a like a tree, where each question and answer is a node, and depending on what path you go down, you're exposed to a specific set of other questions/answers.</p>
  
  <p>I'm trying to figure out how to implement this with reusable React components. I could potentially create a component for each question, but that doesn't seem like good practice. Does anyone have any experience building these sorts of 'choose-your-own-adventure' style questionnaires?</p>