📅  最后修改于: 2022-03-11 15:02:55.753000             🧑  作者: Mango
/*
* A simple React component
*/
class Button extends React.Component {
constructor(){
super();
this.state = {
color_black: true,
}
}
changeColor(){
this.setState({color_black: !this.state.color_black})
}
render(){
let bgColor = this.state.color_black ? this.props.color : this.props.color2
return (
)
}
}
class Application extends React.Component {
render(){
return (
)
}
}
/*
* Render the above component into the div#app
*/
React.render( , document.getElementById('app'));