Last active
December 26, 2018 01:06
-
-
Save hoangthau/c3e1b3bd1e09b267ac7cb6e8fe90f871 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
// Family chỉ làm nhiệm vụ trung chuyển props cho Person | |
const Family = (props) => ( | |
<div className="family"> | |
<Person info={props.person} /> | |
</div> | |
) | |
class Person extends Component { | |
render() { | |
const { age, name } = this.props; | |
return ( | |
<div className="person"> | |
<p>Age: {age}</p> | |
<p>Name: {name}</p> | |
</div> | |
) | |
} | |
} | |
class App extends Component { | |
state = { | |
name: "Dan", | |
age: 28 | |
}; | |
render() { | |
return ( | |
<div> | |
<p>This is a demo that we do not use Context API</p> | |
<Family person={this.state} /> | |
</div> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment