<ComponentName propName="propValue" />) and accepts in the props object inside my component definition (props.propName or this.props.propName).name="value".name={variableName}.name={[arrayValue1, arrayValue2, etc]}. For an object literal, I would do name=. For a functional call, I would do name={this.functionName()}. To pass a callback function, I would do callback={functionName}<div>{this.state.count}</div> or <div>{Math.random() + 10}</div>.super (pass in props), and set this.state to an object containing my initial state:
constructor (props) {
super(props)
this.state = {
count: 0
}
}
this.setState, passing in the new values as key-value pairs: this.setState({ count: 10 }).this.setState, like so:
this.setState((state, props) => {
return { count: state.count + 1 }
})
handleIncrement (event) {
// ...
}
Do this:
handleIncrement = (event) => {
// ...
}
constructor (props) {
super(props)
this.state = { count: 0 }
this.handleIncrement = this.handleIncrement.bind(this)
}