App preview:
Project files:
import React from "react";
import "./App.css"
class App extends React.Component{
state = {
color: 'darkBlue'
};
handleColorChange(event){
console.log(event.target.value);
this.setState({color: event.target.value})
}
render() {
return (
<div className="app" style={{color: this.state.color}}>
<h1>Hello World!</h1>
<input type="input" onChange={(event)=>this.handleColorChange(event)}></input>
</div>
)
}
}
export default App;
.app{
background-color: lightskyblue;
padding: 20px 10px;
}
Top comments (0)