Shopping cart dùng Context + useReducer + localStorage
ex_fetch_users
Component fetch users
Fetch danh sách users từ API có loading / error state
ex_search_filter
Component search & filter
Lọc danh sách users theo từ khóa dùng useState
ex_todo_performance
Component todo + perf
Todo CRUD với memo + useCallback tối ưu re-render (local state)
ex_todo_performance_api
Component todo + perf + API
Todo CRUD với memo + useCallback + gọi MockAPI thực tế
ex_stopwatch
Component đồng hồ bấm giờ
Stopwatch dùng useState + useRef + useEffect có ghi lap
Usage
Gõ prefix vào file .jsx / .tsx và nhấn Tab để tạo code:
hook_usestate → const [state, setState] = useState(null)
hook_useeffect → useEffect với cleanup và dependency
hook_useref_focus → useRef tự động focus input khi mount
hook_useRef_ex → full component demo useRef + focus
hook_useMemo_filter → useMemo lọc danh sách tối ưu
hook_useEffect_debounce → debounce search 500ms với useEffect
hook_usereducer → skeleton reducer + dispatch
hook_custom → custom hook template
router_layout → createBrowserRouter full setup
route_dashboard → Dashboard với Link + Outlet
task_rfc → React Functional Component
task_fetchapi → async fetch với try/catch
task_formhandle → form state + handleChange
task_pagination → logic tính currentItems
ex_todo_reducer → Bài tập Todo với useReducer
ex_theme → Bài tập Theme với Context API
ex_cart → Bài tập Shopping Cart (Context + Reducer)
ex_fetch_users → Bài tập Fetch API có loading/error
ex_search_filter → Bài tập Search & Filter danh sách
ex_todo_performance → Bài tập Todo tối ưu hiệu năng (local)
ex_todo_performance_api → Bài tập Todo tối ưu + CRUD thực với MockAPI
ex_stopwatch → Bài tập Đồng hồ bấm giờ (useRef interval)