<Multiply a="4" b="2" /> // => 8
const multiply = (a, b) => { // <-- Props
const product = a * b // <-- State
return product
}
<Square n="4" /> // ==> 16
class Square extends Component {
render () {
return <Multiply a={this.props.n} b={this.props.n} />
}
}
const square = (n) => { // <-= props
const product = multiply(n, n) // <-- state
return product
}
// multiply(4, 2) // => 8
Props are just like parameters/arguments to a function State is like internal variables scoped to a function