- React nima — declarative UI library
- React tarixi — qisqa timeline: Facebook 2013 → Hooks 2019 → R18 (2022) → R19 (2024)
- Declarative vs Imperative — vanilla JS vs React kod taqqoslash
- Component-based architecture
- Virtual DOM tushunchasi — mental model, Fiber bilan munosabati ("VDOM = idea, Fiber = implementation")
- One-way data flow — props down, events up
- Renderer concept —
react-domfaqat bitta renderer; reconciler boshqa renderer'lar (react-native,react-three-fiber,ink,react-pdf) bilan birga ishlaydi - React 18 → 19 — qisqa o'zgarishlar ro'yxati (chuqur 37-39 da)
- React Compiler — auto-memoization tushunchasi (chuqur 31-da)
- React Server Components (RSC) tushunchasi — nima, nima uchun (chuqur 39-da)
Keyingi: → 02-rendering.md
createRoot+render— entry point- Strict Mode — 2x render, 2x effect (R18+), sabab, development only
- React DOM rolida — renderer + reconciler farqi
- Initial render vs Re-render
- Render Phase — pure, side-effect free, Fiber tree (workInProgress) qurish
- Commit Phase 3 sub-phase:
- Before Mutation —
getSnapshotBeforeUpdate(legacy class) - Mutation — DOM o'zgartirish, refs detach/attach
- Layout —
useLayoutEffect,componentDidMount/Update
- Before Mutation —
- Passive effects — Commit'dan keyin async chaqiriladi (
useEffect) - Batching:
- R17 va undan oldin: faqat React event handler ichida batched (setTimeout, Promise, native DOM listener — emas)
- R18+ Automatic Batching: setTimeout, Promise, native event listener, async/await — barcha kontekstlarda
flushSync— batching'ni majburan to'xtatish (kerak bo'lganda)
- Concurrent features — qisqa overview (chuqur 30-da, internals 05-da)
- Hydration — qisqa intro (chuqur 06-da)
Keyingi: → 03-fiber-architecture.md
Bu qism kursning yuragi. Har fayl 3-qatlamli template bilan to'liq yoritiladi (Nazariya → Under the Hood → Kod).
- Fiber nima — work unit + node in tree
- Fiber tree vs Component tree
currentvsworkInProgress— double bufferingalternatepointer — ikki tree bog'lanishi- Fiber tag types — FunctionComponent, ClassComponent, HostComponent, HostText, Fragment, ContextProvider, MemoComponent, SuspenseComponent, ...
- Fiber traversal —
child,sibling,returnpointers - Why Fiber (R16+) — interruptible rendering, prioritization (eski Stack Reconciler bilan farq)
- Effect list — fiber'larda
flagsvasubtreeFlags
Keyingi: → 04-reconciliation.md
Bu fayl algorithm va reasoning ga fokus. Real-world React.memo qachon tetiklash 32-da.
- Reconciliation nima — old tree vs new tree diff
- O(n) heuristics — naive O(n³) bo'lardi, React 2 ta heuristics:
- Different element types = different subtrees (rebuild)
- Lists with
keyfor stable identity
- Type comparison — same type = update props, different = unmount + mount
- Sibling matching — keyless: index-based; keyed: key-based
- Key-based identity — qachon kerak, nima uchun stabil bo'lishi kerak (cross-ref
08-list-rendering.md) - Bailout algorithm — qachon Reconciler subtree'ni skip qiladi:
- Element identity (
Object.is) — same element reference React.memoshallow check — props equalityuseMemo/useCallback— stable reference- State equality — same value = no update
- Element identity (
- Update propagation — qaerdan boshlanadi, qayerga yetadi (root → leaf)
Keyingi: → 05-scheduler-lanes.md
- Concurrent rendering nima uchun kerak
- Scheduler package —
scheduler/(alohida package) - Priority levels — Immediate, UserBlocking, Normal, Low, Idle
- Lanes model (R18+) — bitmap of priority lanes
- Lane types —
SyncLane,InputContinuousLane,DefaultLane,TransitionLane,IdleLane - Time slicing — work in 5ms chunks, yield to browser
- Interruptible rendering — high-priority kelganda low-priority to'xtatish
- Expiration — old work eventual completion (starvation prevention)
requestIdleCallbackvs custom scheduler — sabab (cross-browser, deterministic)
Keyingi: → 06-hydration.md
- SSR + Hydration concept — server HTML + client JS attach
hydrateRoot—createRooto'rniga, qachon- Hydration mismatch — sabablari (
Date.now,Math.random, browser-only APIs, conditional rendering env-based) suppressHydrationWarning— qachon ishlatish, oqibatlari- Selective hydration (R18) — Suspense bilan, user interaction priority
- Streaming hydration — server qism-qism HTML yuborib, browser bo'lib hydrate
- R19 hydration improvements — better error messages,
onRecoverableError, mismatch diffing
Keyingi: → 07-jsx.md
- JSX vs TSX terminologiyasi — birinchi section
- JSX nima — syntax extension, HTML emas
- JSX vs HTML — farqlar jadvali:
className(HTMLclassreserved keyword JS'da)htmlFor(HTMLforreserved keyword)tabIndex(camelCase)- Event handler nomlari camelCase —
onClickvsonclick styleobject format —style={{ color: 'red' }}(string emas)- Self-closing strict —
<img />,<input />(HTML self-close optional) - Boolean attributes —
disabledvsdisabled={true} - Controlled inputs —
value+onChangesemantikasi (DOMchangeevent'idan farq) onChangehar keystroke'da fires (DOM'dainputevent)
- Transpilation 2 xil:
- Classic transform —
React.createElement(...),import Reactkerak - Automatic transform (R17+, default 2026-da) —
_jsx(...),react/jsx-runtimedan inject, import yo'q
- Classic transform —
- JSX expressions —
{}ichida JS expression (statement emas) - JSX comments —
{/* */} - Single root — sabab (createElement single node return)
- Fragments —
<>,<Fragment key={}>— qachon key kerak - Reserved attribute names — qisqa jadval (className, htmlFor, tabIndex)
- Self-closing va boolean attributes — qisqa qoidalar
- Spread attributes —
{...props}— qachon foydali, qachon xavfli (forwarding bilan unintended props) dangerouslySetInnerHTML— XSS xavfi, sanitization (DOMPurify mention)- Conditional rendering (eski 06 fayldan birlashdi):
- Ternary
{cond ? A : B} &&operator + 0 trap ({count && ...}"0" render qiladi — falsy primitive trap)- Early returns — guard clauses
- Render map pattern —
const views = { admin: <Admin />, user: <User /> }
- Ternary
Keyingi: → 08-list-rendering.md
map()— array → JSX elementskeyprop — nima uchun (cross-ref04-reconciliation.md— node identity)- Key rules — unique, stable, not index (mostly)
- Index as key — qachon OK (static, no reorder), qachon muammo
- Nested lists — key scope
- Key collisions — unique kafolatlash (UUID, composite key)
- Reordering performance — key bilan vs keysiz (Reconciler bilan bog'lanish)
Keyingi: → 09-component-basics.md
- Function components — modern standard
- PascalCase — JSX transform qoidasi (lowercase = HTML tag, capitalized = component)
- Render purity invariant:
- Same props/state → same JSX (deterministic)
- No side effects during render (no setState in body, no DOM mutation, no fetch)
- No reading mutable values (Date.now, Math.random) — bu concurrent rendering bilan birga muhim
- Idempotent — render qancha chaqirilsa, natija bir xil (Strict Mode 2x sabab)
Keyingi: → 10-props.md
- Props = parameters (function arguments)
- Read-only invariant — sabab, mutate qilmaslik kerak
childrendeep:- Special prop,
ReactNodetypes - Function-as-children pattern (render prop preview)
ChildrenAPI qisqa eslatma (chuqur 26-da)
- Special prop,
- Spread
{...props}— qachon foydali, qachon xavfli (DOM attribute leak) - Props drilling muammosi — preview of context
- TS integratsiya:
interface ButtonProps, optional?, union types- Discriminated unions — variant props (
size: 'sm' | 'md' | 'lg',as: 'button' | 'a') - Utility types —
Partial,Pick,Omit ComponentProps<'button'>— native element props- Generic components —
<List<T>>pattern, type inference
- Versiya evolyutsiyasi callout (inline, MAJBURIY):
propTypes→ TS interfaces: Pre-R19 (MyComponent.propTypes = { ... }runtime validation) → R19 (olib tashlandi, TS compile-time bilan almashtirildi). Sabab: TS yetuk, runtime overhead'siz, IDE support yaxshi.defaultProps(function components) → JS default parameters: Pre-R19 (MyComponent.defaultProps = { name: 'Guest' }) → R19 (olib tashlandi,function MyComponent({ name = 'Guest' })). Sabab: JS default parameters native va aniqroq, R19 Compiler optimizatsiyasi uchun ham yaxshi.
Keyingi: → 11-composition.md
- Composition vs Inheritance — React nima uchun inheritance tavsiya qilmaydi
- Slots — children as object pattern, named slots
- Render props preview (chuqur 25-da)
- Compound components preview (chuqur 26-da)
- Inversion of control — render inversiya
- TS integratsiya:
- Polymorphic components —
asprop,ElementType ComponentPropsWithoutRef<E>patternforwardRefpolymorphic typing
- Polymorphic components —
Keyingi: → 12-state-and-usestate.md
Bu fayl eski 12 + 13 + 17 ni birlashtiradi. 3 ta aniq sub-bo'lim bilan.
(1) Mental Model:
- State nima — component ichki xotirasi
- State vs Props — jadval (mutable vs immutable, owner, re-render trigger)
- Immutability invariant — sabab,
Object.is()comparison, identity check
(2) useState API va Updates:
useState—const [value, setValue] = useState(initial)- Initialization — value vs lazy function (expensive initial)
- Functional updates —
setValue(prev => prev + 1)— closure trap fix - Queueing — bir handler ichida ketma-ket
setState'lar (batch + queue) - Stale closure muammosi — sabab, fix patterns
- Immutable updates (objects/arrays bir bo'limda) — spread,
filter/map, structural sharing - Alternativa: Immer (
produce(),useImmer()) — 15 qator mention
(3) Under the Hood:
- Fiber state queue — update objects linked list
- Mount path vs update path —
mountStatevsupdateState - Render-phase update'ni qayta ishlash
- Bailout —
Object.isequal = re-render skip
TS: useState<T> generic, type inference, useState<T | null>(null) pattern
Keyingi: → 13-event-handling.md
- Event handlers —
onClick={handleClick}(NOTonClick={handleClick()}) - SyntheticEvent — nima, nima uchun, cross-browser normalization
- Event object —
e.target,e.currentTarget,e.nativeEvent - Event delegation history (yangi qo'shildi):
- R16: document'ga delegate
- R17+: root container'ga delegate (multiple React apps qo'llab-quvvatlash, microfrontends)
- Event pooling — R17'da olib tashlandi (legacy interview savoli)
- Arguments —
onClick={() => handleClick(id)} - Naming —
onActionprop,handleActionhandler - Inline vs separate — performance, readability
- Propagation —
stopPropagation,preventDefault - Common events —
onClick,onChange,onSubmit,onFocus, keyboard, mouse, touch, pointer - R19:
<form action={fn}>— client-side form actions (yangi qo'shildi)- Function as prop, automatic submission handling
useFormStatus,useActionStatebilan integration (cross-ref 23)- Client-side action vs server action (cross-ref 39)
- TS integratsiya:
MouseEvent<HTMLButtonElement>,ChangeEvent<HTMLInputElement>,FormEvent<HTMLFormElement>- Event narrowing —
e.target instanceof HTMLInputElement - Generic event handlers —
<T extends HTMLElement>
Keyingi: → 14-lifting-and-controlled.md
Bu fayl eski 15 + 28 ni birlashtiradi (dublikat edi).
Lifting state:
- Problem — sibling components share data
- Solution — shared state in parent
- Inverse data flow — callback props
- Single source of truth
Controlled vs Uncontrolled:
- Controlled — React owns state (
value+onChange) - Uncontrolled — DOM owns state (
useRef,defaultValue) defaultValuevsvalue— qachon qaysi- Common form input patterns —
<input>,<textarea>,<select>, checkbox, radio - Hybrid pattern — uncontrolled + ref read on submit
Decision guide:
- Qachon lift, qachon Context (cross-ref 19)
- Qachon controlled, qachon uncontrolled — form complexity, performance, validation timing
Keyingi: → 15-hooks-fundamentals.md
Bu qism eng muhim — har bir hook under the hood bilan tushuntirilsin.
- Nima uchun hooks — class muammolari (this binding, lifecycle soup, logic reuse)
- Rules of Hooks — top level, React functions only
- Under the hood (kengaytirildi):
- Linked list structure — har fiber'da
memoizedStatelinked list - Hook indexing — call order matters
- Mount path vs update path —
HooksDispatcherOnMountvsHooksDispatcherOnUpdate - Dispatcher swap — render boshida React qaysi dispatcher'ni o'rnatadi
- First render: hook objects yaratiladi va saqlanadi
- Re-render: existing hook objects topiladi, update applied
- Linked list structure — har fiber'da
- Why call order matters — index-based hook lookup, conditional hooks taqiqi sababi
- ESLint plugin —
eslint-plugin-react-hooks
Keyingi: → 16-useeffect.md
useEffect"lifecycle hook" EMAS — bu birinchi tushuntiriladigan masala (MAJBURIY section):- Class components: "lifecycle methods" rasmiy termin (
componentDidMount, etc.) - Vue.js: "lifecycle hooks" — Vue terminologiyasi
- React rasmiy termini: "Effects" (lifecycle emas)
- React docs philosophy (react.dev "Synchronizing with Effects"): "Effects are NOT lifecycle events — they are synchronization mechanisms"
- Mental model farqi:
- ❌ Lifecycle: "mount paytida X qil, unmount paytida Y qil" (imperative qadamlar)
- ✅ Effect: "tashqi tizim bilan sinxron bo'lib tur" (declarative sinxronizatsiya)
- Nima uchun bu muhim —
useEffectdeps array, R18 Strict Mode 2x effect, "You Might Not Need an Effect" — bularning hammasi sinxronizatsiya modelidan kelib chiqadi - Class lifecycle bilan mexanik moslashuv (
useEffect≠componentDidMount + componentDidUpdate + componentWillUnmount) — interview savoli, lekin to'g'ri javob: "yondashuv boshqa"
- Class components: "lifecycle methods" rasmiy termin (
- Side effects tushunchasi
- Syntax va dependency array —
[],[deps], no array - Cleanup — return function, qachon chaqiriladi
- Timing — Commit'dan keyin, browser paint dan keyin (passive)
- Effect ordering — child effects parent'dan oldin
- Use cases —
fetch, subscribe, DOM, timers - Pitfalls:
- Infinite loop
- Missing deps
- Object/array deps (referential identity)
- Race conditions (
AbortController)
- Strict Mode double effect (R18+) — sabab, mount-unmount-mount cycle (sinxronizatsiya invariant'i: effect "qaytadan o'rnatilishga chidamli" bo'lishi kerak)
- "You Might Not Need an Effect" — anti-patterns (Dan Abramov post) — sinxronizatsiya modelidan tabiiy kelib chiqadi
- Under the hood — passive flag, effect list, cleanup chain
Keyingi: → 17-uselayouteffect.md
useLayoutEffectvsuseEffect— timing farq:useEffect— async, paint dan keyinuseLayoutEffect— sync, DOM mutation'dan keyin, paint dan oldin
- Layout phase — Commit'ning Layout sub-phase'ida (cross-ref
02-rendering.md) - Use cases — DOM measurement, scroll position, focus management
- Performance pitfalls — bloklayan effect, browser paint kechikish
- SSR cheklov —
useLayoutEffectserver'da warning beradi (yo'l-yo'lakay yechimlar) useInsertionEffect(R18) — CSS-in-JS libraries uchun, layout dan ham oldin- Use case — dynamic stylesheet injection (styled-components, emotion ichki)
Keyingi: → 18-useref.md
- Ref = mutable container, re-render triggerlamaydi
- DOM refs — element access
- Mutable values — timer id, prev value, latest closure
- ref vs state — decision guide
forwardRef(R18) vs ref as prop (R19) — R19'da ref oddiy prop, lekinforwardRefhali deprecated emas (gradually phased out)- Ref cleanup functions (R19) — ref callback dan return function:
<div ref={(node) => { setup(node); return () => cleanup(node); }} />- Sabab — DOM node o'chirilganda cleanup
useImperativeHandlechuqur:- Imperative API expose — declarative pattern bilan tortishuv
- Syntax —
useImperativeHandle(ref, () => ({ focus, scrollTo, ... }), deps) - Real-world: video player controls, modal open/close, focus management
- Anti-pattern — declarative bilan hal qilinishi mumkin bo'lgan narsalarga ishlatmaslik
- Under the hood — ref.current ga assign deps o'zgarganda
- Callback refs — dynamic attachment, conditional ref
- TS:
useRef<HTMLInputElement>(null)forwardRef<RefType, PropsType>typing- R19 ref prop typing —
ref?: Ref<HTMLDivElement>
- Versiya evolyutsiyasi callout (inline, MAJBURIY):
- String refs →
useRef: Pre-R16 (<input ref="myInput" />+this.refs.myInput) → Modern (useRefhook). Sabab: string refs broken in concurrent mode, type-unsafe, hidden state. R19'da string refs to'liq olib tashlandi. forwardRefevolyutsiyasi: R16.3 (forwardRef(...)wrapper introduced — class HOC bilan ref forwarding) → R19 (ref oddiy prop,forwardRefwrapper kerak emas, lekin hali deprecated emas — gradually phased out)- Ref cleanup: Pre-R19 (cleanup yo'q —
useEffectichida manual qilish kerak edi) → R19 (ref callback'dan return cleanup function — DOM node o'chirilganda chaqiriladi)
- String refs →
Keyingi: → 19-usecontext.md
- Prop drilling muammosi
createContext+Provider+useContext- Default value — qachon ishlatiladi
- Multiple contexts — composition
- R19:
<Context value={...}>as provider —<Context.Provider>o'rniga - R19:
use(context)— conditional context reading (Rules of Hooks bilan farq) - Performance:
- Har consumer re-render qachon Provider value o'zgaradi
- Reference identity matters (object value gotcha)
- Splitting contexts — separate state vs dispatch
- Memoizing Provider value
- Selector pattern —
use-context-selectorlibrary (dai-shi, NOT React core) — mental model va ishlash - When Context, when state library
- Versiya evolyutsiyasi callout (inline, MAJBURIY):
- Legacy Context API → modern Context: Pre-R16.3 (
contextTypes+childContextTypesstatic properties +getChildContextmethod) → R16.3+ (createContext+<Provider>+useContext). Sabab: legacy Context bypassshouldComponentUpdate'ni ishlamasdan, type-unsafe, va concurrent mode bilan mos emas. R19'da legacy Context to'liq olib tashlandi. <Context.Provider>→<Context>: R18 va undan oldin (<MyContext.Provider value={...}>) → R19 (<MyContext value={...}>). Sabab:.Providerortiqcha boilerplate edi — Context o'zi provide qila oladi.<Context.Provider>hali deprecated emas (backward compat).use(context)(R19): Conditional context reading —useContextRules of Hooks bo'yicha top-level kerak edi,use()ifichida ham ishlaydi. Sabab: declarative ergonomics.
- Legacy Context API → modern Context: Pre-R16.3 (
Keyingi: → 20-usereducer.md
- Reducer pattern —
(state, action) => newState - vs
useState— qachon qaysi (complex related state, multiple actions) - Action objects —
type+payload - Dispatch — pure, predictable
- Lazy init — third arg
- Context + useReducer = mini state container pattern
- TS: Action discriminated unions, exhaustive type checking via
never - vs Redux/Zustand — qachon scale up
Keyingi: → 21-usememo-usecallback.md
Bu fayl mexanika va API ga fokus. Real qo'llash patternlari 33-optimization.md da.
- Memoization concept — input cache → output reuse
useMemo— computed value'ning referential identity'sini stabil tutishuseCallback— function'ning referential identity'sini stabil tutish- Texnik bog'lanish:
useCallback(fn, deps) ≡ useMemo(() => fn, deps)(semantik ekvivalent, ammo API'lar boshqa) - Mexanika —
memoizedState'da deps + value saqlash, depsObject.iscomparison - When to use —
React.memobilan, dependency arrays - When NOT — premature optimization (compute < lookup)
- React Compiler ta'siri — auto-memoization, manual kerak emas bo'lib qolishi (chuqur 31-da)
Keyingi: → 22-concurrent-hooks.md
useTransition—isPendingstate, urgent vs non-urgent updatesuseDeferredValue— deferred rendering, input vs display valueuseSyncExternalStore— external state subscription, tearing prevention (concurrent rendering bilan)useId— unique ID generation, SSR-safe (hydration mismatch oldi olish)- Decision tree —
useTransitionvsuseDeferredValuevs neither (qaysi qachon) - Har biri — nima, qachon, real-world misol, internals (cross-ref
05-scheduler-lanes.md)
Keyingi: → 23-r19-hooks.md
use()— Promise va Context ni render da o'qish (Suspense bilan integration)useFormStatus()— form submission holati (pending, data, method, action) —<form action={fn}>ichida ishlaydi (cross-ref 13)useActionState()— form action state management (avvaluseFormStateedi)useOptimistic()— optimistic UI updates, rollback on error- Decision tree — qaysi hook qachon, R19 form ekosistema bilan integration
Keyingi: → 24-custom-hooks.md
- Custom hook =
use*function - Logic extraction va reuse
- Parameters va return types
- Composing hooks
- Common hooks:
useLocalStorage,useDebounce,useWindowSize,usePrevious,useOnClickOutside,useMediaQuery,useFetch,useIntersectionObserver,useEventListener useDebugValue— DevTools'da custom hook'ni ko'rinishini boyitish (faqat custom hooks ichida ishlatiladi)- TS: Generic custom hooks pattern, return tuple vs object
Keyingi: → 25-legacy-patterns.md
Bu fayl eski 25 + 26 ni birlashtiradi. Custom hooks ko'p hollarda yaxshiroq alternativa.
Render Props (children-as-function bilan birga):
- Pattern nima — muammo va yechim
- Ikki shakl:
<Foo render={...}>vs<Foo>{(...) => ...}</Foo>(children-as-function) - Real-world misol
- Hooks bilan comparison — qachon render props, qachon custom hook
- TS: Render prop typing
HOC (Higher-Order Components):
- Pattern nima — muammo va yechim
- Wrapping qoidalari —
displayName, ref forwarding, props passthrough - Real-world misol —
withAuth,withLoading - Hooks bilan comparison
- TS: HOC generics —
<P extends object>(Component: ComponentType<P>) => ComponentType<P & ExtraProps>
Modern alternative: Custom hooks (cross-ref 24) — qaysi holatda render prop/HOC hali kerak
Keyingi: → 26-compound-components.md
- Pattern nima — muammo va yechim
- Context bilan implementation
- Flexible API dizayni — parent-child implicit state sharing
- Real-world misol — Select, Tabs, Accordion
React.ChildrenAPI (yangi qo'shildi):Children.map,Children.toArray,Children.onlycloneElement— props injection- Modern alternativa — Context bilan
- Modern Compound vs Children API — qachon qaysi
Keyingi: → 27-error-boundaries.md
Class faqat error boundaries uchun kerak (R19'gacha hali class). Class primer minimal — faqat error boundary yozish uchun yetarli.
Class minimal primer (1 qisqa intro section):
class X extends React.Component,state,render()— error boundary uchun zarur minimum- Lifecycle methods qisqa overview (faqat error boundary uchun kerak — class lifecycle methodlari):
componentDidMount≈useEffect(() => {...}, [])mount qismicomponentDidUpdate≈useEffect(() => {...}, [deps])updatecomponentWillUnmount≈useEffectcleanup return functiongetDerivedStateFromErrorvacomponentDidCatch— error boundary uchun maxsus, hooks bilan almashtirib bo'lmaydi (shu sababli class hali kerak)
- Versiya evolyutsiyasi callout (inline, MAJBURIY):
- Class lifecycle methods → Hooks: Pre-R16.8 (class lifecycle:
componentDidMount,componentDidUpdate,componentWillUnmount,componentWillMount,componentWillReceiveProps,componentWillUpdate, ...) → R16.8+ (Hooks bilan almashtirildi:useEffect,useLayoutEffect,useState, ...). Sabab: lifecycle methodlar logic reuse'ni qiyinlashtirardi (HOC, render props bilan kurashish),thisbinding murakkabligini, lifecycle "soup" — bir methodda turli concerns. Ammo:useEffectlifecycle method'ning mexanik almashtiruvi emas — sinxronizatsiya modeli (cross-ref16-useeffect.md). UNSAFE_*lifecycle methods: R16.3+ —componentWillMount,componentWillReceiveProps,componentWillUpdate— concurrent rendering bilan mos emas,UNSAFE_prefiksi bilan deprecated. R19'da hali bor lekin warning bilan.
- Class lifecycle methods → Hooks: Pre-R16.8 (class lifecycle:
Error boundaries asosiy:
componentDidCatch+getDerivedStateFromError— ikki signature- Error catching scope — render, lifecycle, constructor (NOT event handlers, async, SSR)
- Placement strategy — granular vs global, qayerga qo'yish kerak
- Error recovery —
keyprop bilan boundary reset pattern - Fallback UI patterns
Modern alternativa: react-error-boundary library (15 qator mention) — hooks-based reset
R19 root callbacks:
onCaughtError— caught by boundaryonUncaughtError— no boundary caughtonRecoverableError— auto-recovered (asosan hydration mismatch)createRoot(container, { onCaughtError, ... })syntax
Keyingi: → 28-portals.md
createPortal— DOM tree vs React tree- Modal, tooltip, dropdown use cases
- Event bubbling — React tree bo'ylab (DOM tree emas) — important advanced detail
- Focus management — a11y considerations, focus trap
- z-index issues va stacking contexts
- SSR considerations — portal target server'da yo'q
Keyingi: → 29-suspense-lazy.md
- Code splitting —
React.lazy+Suspense - R19 —
use()+Suspense— Promise handling - Nested Suspense boundaries — granular loading states
- Loading states va fallback — Skeleton, Spinner patterns
- Suspense for data fetching — R19 pattern
- Streaming SSR — Suspense bilan progressive rendering (qisqa intro, chuqur 39-da)
SuspenseList— eslatma: experimental edi, R19 stable'ga chiqmadi (status verify, 1-2 paragraf)
Keyingi: → 30-concurrent-react.md
Bu fayl mental model va invariants'ga fokus — concurrent rendering nima uchun komponent yozish usulini o'zgartiradi. Scheduler internals 05-scheduler-lanes.md da, hook APIs 22-concurrent-hooks.md da.
- Sync vs Concurrent rendering — eski mental model bilan farq (uninterruptible vs interruptible)
- "Render Phase restartable" — komponent purity nima uchun majburiy (mutation taqiqi, idempotency)
- Strict Mode 2x effect (R18+) — concurrent invariants bilan bog'liqlik (mount → cleanup → mount cycle, sabab)
- Tearing tushunchasi — concurrent rendering ichida external store consistency muammosi (
useSyncExternalStorebilan hal qilinadi, cross-ref 22) - React Concurrent invariants:
- Render purity (no side effects in body)
- State updates merged consistently (functional updates muhim)
- Effects run consistently with rendered tree (cleanup + setup pair)
- External data subscription must be consistent across re-tries
- Concurrent anti-patterns:
- Render ichida mutation
- Side-effects in setState callbacks
- Stale closure with concurrent state
- Reading external mutable values during render
startTransition— concurrent invariants context'ida (cross-ref22-concurrent-hooks.md)
Keyingi: → 31-react-compiler.md
Eski 32-concurrent-react.md ichidan ajraldi. Compiler build-time, concurrent runtime — alohida fayl mantiqli.
- Compiler nima — build-time tool, source code'ni tahlil qiladi
- Auto-memoization —
useMemo,useCallback,React.memokerak emas - Static analysis — qaysi values change bo'ladi, qaysi yo'q
- Build-time optimization — generated optimized code
eslint-plugin-react-compiler— qoidalar nazorati- "Rules of React" — Compiler talablar (mutability, side effects qoidalari)
- Cheklovlar — qaysi kodda ishlamaydi (mutable, side effects, refs misuse)
- Migration — mavjud project ga qo'shish (incremental adoption)
- Manual memo bilan munosabat — Compiler bilan ortiqcha bo'lib qoladi (cross-ref 21)
Keyingi: → 32-rendering-behavior.md
Bu fayl practical re-render triggers ga fokus. Reconciler bailout algorithm 04-reconciliation.md da.
- Re-render triggers — state, props (parent re-rendered), context, force update
- Why parent re-render = children re-render (default) — Reconciler logic (cross-ref 04)
- Component tree propagation — top-down default behavior
- Context re-render scope — har consumer (cross-ref 19)
React.memotriggers — qachon shallow check yetarli, qachon customareEqualkerak- Reference equality gotchas — inline objects/functions, array literals
- "New element same type" — props o'zgarganda update path
- Practical debugging — DevTools "Why did this render?"
Keyingi: → 33-optimization.md
Bu fayl real qo'llash patternlari ga fokus. Mexanika 21-usememo-usecallback.md da.
- Measure before optimize — DevTools Profiler workflow
React.memo— shallow comparison, custom comparator (areEqual)useMemovauseCallbackreal qo'llash — qachon kerak, qachon kerak emas- Key-based reset — component state reset trick (cross-ref
08-list-rendering.md) - React Compiler bilan munosabat — qaysi optimize manual qoladi
- Splitting state across components — re-render scope
- Anti-patterns — premature memoization, unnecessary
useCallback
Keyingi: → 34-profiling.md
- React DevTools Profiler — record, flame graph, ranked chart, commits
<Profiler>component (yangi qo'shildi) — programmaticonRendercallback, production telemetry- Production profiling —
react-dom/profilingbuild - What to look for — slow renders, unnecessary re-renders, expensive components
- Highlight Updates — DevTools setting
Keyingi: → 35-code-splitting.md
- Component-based splitting —
React.lazy(cross-ref29-suspense-lazy.md) - When to split — bundle size, route boundaries (route-based —
/routing/kursida) - Prefetching strategies — hover, idle, viewport intersection
- R19 Preloading APIs —
preload(),preinit(),prefetchDNS(),preconnect()(chuqur37-react-19-document-apis.mdda)
Keyingi: → 36-virtualization.md
- Problem — large list rendering (10k+ items)
- Windowing concept — faqat ko'rinadigan elementlar
- Pure React implementation —
useRef+onScroll+ calculate visible items - Variable height items — measurement strategies
- Infinite scroll + virtualization concept
- Library mention — TanStack Virtual (2D), react-window (1D) — farqi va qachon qaysi (15 qator)
Keyingi: → 37-react-19-document-apis.md
Document Metadata:
<title>,<meta>,<link>— har qanday component ichida- Hoisting — React avtomatik
<head>ga ko'chiradi - Deduplication — bir xil meta tags birlashtiradi
- Nima uchun react-helmet kerak emas
Stylesheet support:
<link rel="stylesheet" href="..." precedence="default" />- Precedence ordering — qaysi stylesheet birinchi
- SSR loading optimization
- Suspense bilan integration — stylesheet yuklanguncha kutish
Async Scripts:
<script async src="..." />— component ichida- Deduplication — bir xil script bir marta yuklanadi
- Render tree-da qayerda bo'lsa, shu joyda
Preloading APIs:
preload(href, options)— resurs oldindan yuklashpreinit(href, options)— stylesheet/script oldindan initprefetchDNS(href)— DNS oldindan resolvepreconnect(href)— connection oldindan ochish- Qachon ishlatish — performance optimization timing
Keyingi: → 38-react-19-changes.md
Eski versiyada bu fayl "API Changes & Migration" edi. Migration mazmuni har mavzuga inline callout sifatida tarqaldi (Section 2.6 standart). Endi 38 = Web Components substantiv mavzu.
Web Components nima va nima uchun:
- Custom Elements browser-native komponent standarti (
HTMLElementextend) - Shadow DOM, Custom Events, Slots — Web Components ekosistema
- React-Web Components interop muammolari (pre-R19 cheklovlar)
Properties vs Attributes (R19'da hal qilingan):
- HTML attributes faqat string — primitive types
- DOM properties — har qanday JS qiymat (object, function, array)
- React qachon property sifatida assign qiladi (object/function detect qilinsa), qachon attribute
- Pre-R19 cheklov: ko'p hollarda attribute sifatida string'ga konvertatsiya
Custom Event Handling:
- React's synthetic events vs native CustomEvent
addEventListenerishlatilishi — React'ningon*props ishlamagandauseEffectichida event listener attach pattern
Slots va Shadow DOM:
- Web Components
<slot>— Reactchildrenbilan integration - Shadow DOM scope — React tree bilan ko'rinmas chegara
- Style isolation — CSS-in-JS vs shadow DOM
Decision: Web Component vs React Component:
- Cross-framework UI library — Web Component yaxshi (lit, stencil)
- React-only ekosistema — React component yaxshi
- Design system primitives — Web Component (framework-agnostic)
- Business logic — React component
Library mention: lit, stencil, fast — qaysi qachon
Versiya evolyutsiyasi callout:
- React + Web Components: Pre-R19 (cheklov: ko'p props attribute sifatida string'ga, custom events qiyin) → R19 (full property assignment, custom events native qo'llab-quvvatlash). Sabab: ekosistema integration (design systems framework-agnostic).
Keyingi: → 39-rsc-server-actions.md
RSC nima:
- Server Components vs Client Components — render joyida farq
"use server"va"use client"directives- Serialization boundary — JSON-like, function/Date/Map o'tmaydi
- Server Component tree → Client Component tree
- RSC payload — wire format
async function Component()— server-only feature
Streaming:
- Streaming SSR — HTML qismlab yuborish
renderToReadableStream(Web Streams API)renderToPipeableStream(Node Streams)- Suspense + Streaming
- Progressive hydration concept
Server Actions concept:
"use server"— server-side function<form action={serverAction}>— server form actions (client-side13-event-handling.mdda)- Non-form usage —
startTransitionbilan - Error handling concept
- Optimistic updates concept (
useOptimisticbilan)
Framework chegarasi:
- Nima uchun framework kerak — server runtime, special bundler, streaming protocol, router integration
- Framework'siz vanilla React + Vite'da RSC ishlamaydi
- Implementatsiya — alohida
/next/kursda chuqur