Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Thau Nguyen hoangthau

🎯
Focusing
Block or report user

Report or block hoangthau

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View noContextAPI.js
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 {
View contextAPI.js
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,
You can’t perform that action at this time.