Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react extends component App.defaultProps

class App extends React.Component {

render() {
  return (
  <>
      <h1>{this.props.headerProps}</h1>
      <h2>{this.props.contentProps}</h2>
      </>
    );
}
}
App.defaultProps = {
  headerProps : "Header Props",
  contentProps: "Content PROPS"
  
}
ReactDOM.render(
<App />,
document.getElementById ('mountNode'));


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