- Đôi tượng: mới bắt đầu học ReactJS mà không biết học những gì.
- Yêu cầu kiến thức:
- Javascript cơ bản: https://javascript.info/
- ES6 syntax: http://es6-features.org/#Constants
- Git cơ bản: Học cách quản lý source code
- NPM (Node Package Manager): Tìm hiểu xem đây là gì?
- Tiếng Anh (vì tài liệu đa số là Tiếng Anh)
This file contains hidden or 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
| There is no way to store an empty object/array/null value. | |
| There are also no actual arrays. Array values get stored as objects with integer keys. | |
| (If all keys are integers, it will be returned as an array.) | |
| Basically, it's one giant tree of hashes with string keys. | |
| Simply write a value to any location, and the intermediary locations will automatically come into existance. | |
| ── Classes ── | |
| DataSnapshot : Container for a subtree of data at a particular location. |
To paginate a page, a general algorithm needs to be followed. Also, you should have the following variables in place:
- Total items availabe or Items count
(It can be a list of patients, books, etc coming from the database) - Number of items to display per page or Page size
- Page count or number of pagination buttons to be rendered (**NB:**This needs to be calculated)
Calculation:
This file contains hidden or 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://meyerweb.com/eric/tools/css/reset/ | |
| v2.0-modified | 20110126 | |
| License: none (public domain) | |
| */ | |
| html, body, div, span, applet, object, iframe, | |
| h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
| a, abbr, acronym, address, big, cite, code, | |
| del, dfn, em, img, ins, kbd, q, s, samp, | |
| small, strike, strong, sub, sup, tt, var, |
- Async => bất đồng bộ?, Action => hành động?
- là một action trong trạng thái chưa sẵn sàng thực thi ví dụ Fetch API request lên server
- React không hỗ trợ async action => cần 1 middleware trung gian điều phối việc nhận kết quả fetch trả về từ api rồi khi nào mới được dispatch => đảm bảo không bị lỗi chương trình react
- khác với middleware ở server
This file contains hidden or 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, { useMemo, useState, useEffect } from "react"; | |
| import { render } from "react-dom"; | |
| function useAsync() { | |
| return useMemo(() => { | |
| let controller; | |
| const start = (url, options, update) => { | |
| // sử dụng AbortController để thông báo với fetch rằng chúng ta muốn cancel 1 request | |
| controller = new AbortController(); | |
| const signal = controller.signal; |
OlderNewer