JavaScript FrameworksReact

React Class Components

Class components have state and lifecycle hooks. Thus a component that has a state property is called a “stateful component” – all class components are stateful.

class App extends React.Component {
  constructor(props){
     super(props);
     this.state = {message : "Welcome!"};    //a state property ==> stateful component
  }
  render() {
      return ( 
        <div> 
          <p>My message: {this.state.title}</p>
          <p>Parent's message: {this.props.message}</p>
        </div> 
      );
   }
}
Verified by MonsterInsights