RN Learning Playground

App thực hành xuyên suốt để học thật, debug thật, ôn phỏng vấn thật

Thực hành xuyên suốt ⏱ Làm song song với 15 module 📋 Mục tiêu: biến kiến thức thành app chạy được

🎯 Mục tiêu

Project này gom các kiến thức trong tài liệu vào một app nhỏ nhưng đủ giống app đi làm: có auth, navigation, API, cache, form, cart, storage, test, performance và release checklist.

Nguyên tắc: Mỗi module không chỉ đọc xong là tick. Phải áp dụng ít nhất một phần vào playground, gặp lỗi, debug, fix, rồi tự trả lời được câu hỏi phỏng vấn liên quan.

🧭 Vòng lặp học thật

  1. Hiểu bản chất: Concept này giải quyết vấn đề gì trong mobile app?
  2. Thấy bug thật: Nếu dùng sai, app sẽ hỏng ở đâu?
  3. Biết debug: Dùng log/tool/test nào để tìm nguyên nhân?
  4. Biết fix: Sửa tối thiểu, có trade-off rõ.
  5. Trả lời phỏng vấn: Nói được short answer, deep answer, real case, pitfall.
  6. Áp dụng vào playground: Commit nhỏ, có acceptance criteria.

📱 App spec

FeatureMục tiêu họcModule liên quan
Auth flowLogin/logout, token refresh, reset navigation05, 07, 11
Product list/detailAPI layer, React Query, FlatList, cache03, 07, 08
CartClient state, persist, derived total06, 11
Profile formControlled inputs, validation, keyboard02, 03, 04, 12
Deep linkOpen product/order from URL or notification05, 14
Offline draftQueue mutation, retry, conflict note07, 11, 15
TestingLogin, API error, cart store, smoke E2E12
PerformanceMeasure list render, image load, startup tasks08, 09
ReleaseCI checklist, sourcemap, OTA decision13

📦 Milestone theo module

M01 — JS/TS: Define typed API models: User, Product, CartItem, ApiResult<T>, PaginatedResponse<T>. Không dùng any.
M02 — React Core: Build ProductCard, QuantityStepper, ErrorBoundary. Test key ổn định khi add/remove/reorder list.
M04 — Hooks: Viết useDebounce, useKeyboardVisible, useAppStateRefresh. Có cleanup và tránh stale closure.
M03 — RN Basics: Build Login/Profile screen xử lý Safe Area, keyboard, image remote, responsive grid.
M05 — Navigation: Tạo Auth stack, Main tabs, Product detail, Cart, Profile. Login/logout dùng reset stack. Deep link product hoạt động khi app cold start.
M07 — Networking: Tạo Axios client, typed error, token refresh queue, React Query hooks, infinite product list.
M06 — State: Cart dùng Zustand hoặc Redux Toolkit. Persist cart, không persist loading/error. Derived total không tính lại thừa.
M11 — Security/Storage: Refresh token lưu Keychain/SecureStore. Logout clear token, query cache, cart nhạy cảm, navigation state.
M12 — Testing: Test LoginForm, cart store, API 401/422/500, navigation login -> home, smoke E2E.
M08 — Performance: Đo render count của ProductCard, optimize FlatList/FlashList, đo before/after. Không tối ưu nếu không có số liệu.
M09 — Animation: Thêm micro-interaction cho add-to-cart hoặc swipe action. Kiểm tra không conflict với FlatList scroll.
M14/M10 — Android & Native: Thêm deep link Android intent-filter, đọc Logcat, mô phỏng native module contract nếu cần.
M13 — CI/CD: Viết release checklist, OTA decision table, CI quality job, sourcemap note.
M15 — System Design: Viết design note cho app: auth, product cache, cart persist, offline draft, monitoring, failure modes.

🐞 Bug lab bắt buộc

Chủ động tạo bug rồi debug. Đây là phần biến kiến thức thành kinh nghiệm.

BugCách tạoĐiều phải học được
Stale closureSearch debounce đọc keyword cũDependency, ref latest callback, cleanup
Concurrent 401Cho 5 request cùng hết tokenRefresh queue, reject queue, logout một lần
Back về LoginLogin bằng navigate thay vì resetNavigation stack là state machine
List re-render quá nhiềuInline callback/style truyền vào memo itemStable props, profiler, đo before/after
Keyboard che formForm dài trên Android màn nhỏKeyboardAvoidingView, ScrollView, adjustResize
Cache leak sau logoutKhông clear QueryClientSecurity boundary khi đổi user
E2E flakyDùng sleep cố địnhWait for element, deterministic test data

🎤 Cách ôn phỏng vấn từ playground

Format trả lời mỗi feature
  1. Short answer: nói trong 30 giây.
  2. Deep answer: giải thích mental model và trade-off.
  3. Real case: lấy bug trong Bug lab làm ví dụ.
  4. Debug path: nêu bước tìm nguyên nhân.
  5. Follow-up: chuẩn bị câu hỏi nếu interviewer đào sâu.

✅ Definition of done

📎 Ghi chú

Không cần app lớn. App nhỏ nhưng có bug thật, debug thật, test thật, release thinking thật sẽ giúp phỏng vấn tốt hơn nhiều so với đọc thêm 20 topic rời rạc.