React - props.children

HTML files would get rendered into PowerPoint-style presentations. Usually two columns per slide (see the row and col classes in the snippets). I added markdown section headings to make reading easier and only included several slides to showcase the format of files I've been working with

Composition and props.children

<section id="composition" class="chapter">
  <div>
    <h1>Composition and <br>props.children</h1>
  </div>
</section>

<section><h1>Composition vs. inheritance</h1>
  <div class="row">
    <div class="col-6">
      <p>
        You know the concept of
        <span class="is-text-bold">inheritance</span> from object-oriented programming. It means that a class can extend another class with new functionalities.
      </p>
      <p>While this is a good programming paradigm, it does not apply to React.</p>
    </div>

    <div class="col-6">
      <p>
        Beginner React programmers sometimes want to create components using inheritance (after all, we use classes).
      </p>
      <p>
        For example, it may seem that
        <span class="is-text-bold">a yes/no message</span> and an
        <span class="is-text-bold">informational message</span> can and should inherit from a
        <span class="is-text-bold">common, generic message component</span>.
      </p>
      <p>
        This is not the case, however –
        <span class="is-text-bold">in React, composition is always preferred</span>.
      </p>
    </div>
  </div>
</section>

Composition

Composition - slide 2

Last updated