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 { |
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'; | |
// đầu tiên tạo một context | |
const MyContext = React.createContext(); | |
// Sau đó tạo một Context Provider | |
class MyProvider extends Component { | |
state = { | |
name: 'Dan', | |
age: 100, |