Components
1. Vì sao phải dùng Components
Để dễ quản lý và thiết kế người ta sẽ chia 1 trang html thành nhiều components nhỏ hơn.

Components let you split the UI into independent, reusable pieces, and think about each piece in isolation.
Nguyên lý : "Chia để trị " là nguyên lý cơ bản của lập trình, khi thành phần quá lớn quá phức tạp sẽ được chia ra các thành phần nhỏ.
2. Function Components
Function components là cách đơn giản nhất để viết một JavaScript function.x

Để dùng hiệu quả nên chú ý kỹ phần Import và Export
3. Class component
React Component
import React, { Component } from "react";
class Hello extends Component {
constructor(props) {
super(props);
this.state = {};
}
render() {
return <h1>React Component</h1>;
}
}
export default Hello;
4. Các phím tắt hay dùng



Last updated
Was this helpful?