Search
 
SCRIPT & CODE EXAMPLE
 

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'));

Comment

react extends component this.props

class App extends React.Component {

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


Comment

PREVIOUS NEXT
Code Example
Javascript :: js input trigger oninput event 
Javascript :: flatten 2d array javascript 
Javascript :: hide the js code from source 
Javascript :: ho to loop trough an array of objects 
Javascript :: wordpress ajax trigger code 
Javascript :: react hook example 
Javascript :: window change detect 
Javascript :: nodejs download file 
Javascript :: nodejs read image as base64 
Javascript :: catch javascript 
Javascript :: remove first and last element from array javascript and seprated by comma 
Javascript :: reload datatable without ajax 
Javascript :: moment format dd.mm.yyyy 
Javascript :: angular read config from json 
Javascript :: compare two dates and sort array of objects 
Javascript :: import syntax node 
Javascript :: classlist 
Javascript :: arry to object using reduce 
Javascript :: sequelize left join attributes 
Javascript :: javascript change class name 
Javascript :: javascript get fibonacci number 
Javascript :: javascript shift everything in array to the right 
Javascript :: datatable index column server side 
Javascript :: array fill 
Javascript :: javascript onclick append a new row to table 
Javascript :: js get current year last 2 digits substring 
Javascript :: js create json from object 
Javascript :: usememo react 
Javascript :: input in js 
Javascript :: get current date javascript yyyy-mm-dd 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =