Class Component

> (World Wide) Web - (W3|WWW) > Javascript (Js|ECMAScript) > React > Class Component

1 - About

A component in a Class representation

Advertising

3 - Syntax

class Welcome extends React.Component {
 
   // Optional. Needed to set state
  constructor(props) {
     super(props); // Always call the base constructor with props.
  }
 
  render() {
    return <h1>Hello, {this.props.name}</h1>;
  }
 
}

Feature available only to classes:

web/javascript/react/class/class.txt · Last modified: 2019/06/17 09:34 by gerardnico