Open dryben opened 4 years ago
https://reactjs.org/tutorial/tutorial.html#function-components In React, function components are a simpler way to write components that only contain a render method and don’t have their own state.
class Square extends React.Component { render() { return ( <button className="square" onClick={()=> this.props.onClick()}> {this.props.value} </button> ); } }
function Square(props) { return ( <button className="square" onClick={props.onClick}> {props.value} </button> ); }
class & function
https://reactjs.org/tutorial/tutorial.html#function-components In React, function components are a simpler way to write components that only contain a render method and don’t have their own state.