This gist is no longer in use.
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
class Example extends React.Component< | |
Props, | |
State, | |
Snapshot | |
> { | |
static getDerivedStateFromProps( | |
nextProps: Props, | |
prevState: State | |
): $Shape<State> | null { | |
// ... |
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
# GET VERSION | |
yarn -v (or --version) | |
# GET HELP | |
yarn help | |
# CREATE PACKAGE.JSON | |
yarn init | |
yarn init -y // Use defaults |
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
/* This API wrapper is useful because it: | |
1. Centralizes our Axios default configuration. | |
2. Abstracts away the logic for determining the baseURL. | |
3. Provides a clear, easily consumable list of JavaScript functions | |
for interacting with the API. This keeps API calls short and consistent. | |
*/ | |
import axios from 'axios'; | |
let api = null; |
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
https://www.youtube.com/watch?v=UB1O30fR-EE&list=PLillGF-RfqbYeckUaD1z6nviTp31GLTH8 |
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
Comment.defaultProps = { | |
valueInput: '' | |
} | |
Comments.propTypes = { | |
addComment: PropTypes.func.isRequired, | |
comments: PropTypes.array.isRequired, | |
changeText: PropTypes.func.isRequired | |
} |
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
http://coenraets.org/present/es6 |
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
// class | |
class Hamburger { | |
constructor() { | |
// This is the constructor. | |
} | |
listToppings() { | |
// This is a method. | |
} | |
} |
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
const dùng để khai báo một hằng số - là một giá trị không thay đổi được trong suốt quá trình chạy. | |
const A = 5; | |
A = 10; // Lỗi Uncaught TypeError: Assignment to constant variable | |
let tạo ra một biến chỉ có thể truy cập được trong block bao quanh nó, khác với var - tạo ra một biến có phạm vi truy cập xuyên suốt function chứa nó. | |
function foo() { | |
let x = 10; | |
if (true) { |