Day 54: React Course on Udemy

Class Components Using ES6 Classes

  1. If component needs to use "this" keyword, use ES6 Classes
  2. If component needs Lifecycle Methods
// The component name is capitalized
// ES6 class will extend the React.Component class from the React package
class Shapes extends React.Component {
  render() {
    return(
      <h1>Circle, Square, Rectangle</h1>
    );
  }
}

// Render our component to the DOM by passing variable Shapes within self-closing tags.
ReactDOM.render(
  <Shapes />,
  document.getElementById("app")
);