Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react extends component construtor super props

class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      header: "Header from state...",
      content: "Content from state..."
    }
  }
render() {
  return (
  <>
      <h1>{this.state.header}</h1>
      <h2>{this.state.content}</h2>
      </>
    );
}
}
ReactDOM.render(
<App />,
document.getElementById ('mountNode'));

Source by jscomplete.com #
 
PREVIOUS NEXT
Tagged: #react #extends #component #construtor #super #props
ADD COMMENT
Topic
Name
1+3 =