Академический Документы
Профессиональный Документы
Культура Документы
import './App.css';
// function Helloworld(props){
// return (
// <div id="hello">
// <h3>{props.subtitle}</h3>
// {props.mytext}
// </div>
// )
// }
state={
show: true
}
toggleShow = () => {
this.setState({show: !this.state.show})
}
render(){
if(this.state.show){
return (
<div id="hello">
<h3>{this.props.subtitle}</h3>
{this.props.mytext}
<button onClick={this.toggleShow}>Toggle Show</button>
</div>
)
}else{
return <h1>There are not elements
<button onClick={this.toggleShow}>Toggle Show</button>
</h1>
}
}
}
function App() {
return (
<div>This is my component:
<Helloworld mytext="Hello Fazt" subtitle="lorem ipsum"/>
<Helloworld mytext="hola mundo" subtitle="dsdf"/>
<Helloworld mytext="Hello!" subtitle="component 3"/>
</div>
);
}
#hello{
border: 1px solid #000;
}
New Project: