useRef: Thao Tác DOM & Giữ Giá Trị Mutable Không Re-render
Phân biệt khi nào cần useState vs useRef, cách truy cập phần tử DOM trực tiếp, lưu trữ Timer ID và cú pháp ref trong React.
Môi trường thực hành:
React v19.2 (Client Sandbox)
ESM CDN · Hot Reload
React Playground
React v19.2
Interactive Client Sandbox · Live Hot Reload
4 files
src/main.tsx
Entry File
Instructions:Thực hành React: useRef: Thao Tác DOM & Giữ Giá Trị Mutable Không Re-render. Bạn có thể xem cấu trúc index.html, main.tsx và trực tiếp chỉnh sửa component trong src/App.tsx.