const Button = () => {
return (
<div className="Button">
About
</div>
);
};
class ParentComponent extends Component {
render () {
return (
<ChildComponent
name="John"
/>
);
}
};
class ChildComponent extends Component {
render () {
return (
<h1>My name is {this.props.name}!!</h1>
);
}
};
class Square extends React.Component {
constructor(props) {
super(props);
this.state = {
value: 0,
};
}
render() {
const { value } = this.state;
return (
<button className="square" onClick={() => {
this.setState({value: ++value})
}}>
{this.state.value}
</button>
);
}
}