react-fiber-architecture
Use when the user asks about React Fiber, reconciliation, render vs commit phase, lanes, concurrent rendering, time slicing, the React scheduler or why a…
от j4flmao★ 47 звёзд на GitHub
Установить react-fiber-architecture в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
React Fiber Architecture
Purpose
Fiber is React's reconciler (since React 16): a linked tree of work units that lets React split rendering into interruptible chunks, prioritise updates with lanes, and commit changes atomically. Knowing the model explains concurrent features (useTransition, useDeferredValue, Suspense), double renders in Strict Mode, and why render functions must be pure.
Agent Protocol
Trigger
"fiber", "reconciliation", "reconciler", "render phase", "commit phase", "lanes", "time slicing", "concurrent rendering", "scheduler", "double render", "tearing".
Input Context
- React version (18/19) and root API (
createRootenables concurrent features). - Observed behaviour (extra renders, janky input, stale UI, effect order).
- Profiler output if available (React DevTools Profiler, Performance panel tracks).
Output Artifact
Explanation of the behaviour in Fiber terms + concrete code change.
Response Format
Symptom: {what was observed}
Phase: {render|commit|passive effects}
Priority/lane: {sync|input|transition|idle}
Cause: {e.g. impure render, unstable key, sync update blocking}
Fix: {code change}
Fiber Node (simplified, React 18/19 source)
type Fiber = {
tag: WorkTag; // FunctionComponent, HostComponent, SuspenseComponent, ...
key: string | null;
type: any; // component function or host tag ('div')
stateNode: any; // DOM node for host fibers
return: Fiber | null; // parent
child: Fiber | null; // first child
sibling: Fiber | null; // next sibling
index: number;
pendingProps: any;
memoizedProps: any;
memoizedState: any; // hooks linked list for function components
updateQueue: unknown;
lanes: Lanes; // pending work on this fiber
childLanes: Lanes; // pending work in subtree
flags: Flags; // Placement, Update, ChildDeletion, Passive, ...
subtreeFlags: Flags; // aggregated flags of descendants
deletions: Fiber[] | null;
alternate: Fiber | null; // the other tree's version of this fiber
};
Older articles describe an "effect list" (effectTag, nextEffect, firstEffect); React 18 replaced it with flags + subtreeFlags, letting commit skip subtrees with no work.
Double Buffering
currenttree = what is on screen.workInProgresstree = being built.- Each fiber points to its counterpart via
alternate; React reuses those objects between renders. - On commit, the root's
currentpointer swaps to the finished work-in-progress tree in one step, so users never see a half-updated UI.
Phases
| Phase | Interruptible | What happens | Your code that runs |
|---|---|---|---|
| Render | Yes (in concurrent renders) | beginWork walks down calling components and diffing children; completeWork walks up creating/preparing host nodes and bubbling flags |
Component bodies, useState initializers, useMemo, reducers |
| Commit — mutation | No | Apply DOM insertions/updates/deletions; detach refs | ref cleanup, useInsertionEffect |
| Commit — layout | No | Attach refs, run layout effects synchronously before paint | useLayoutEffect, ref callbacks |
| Passive effects | Scheduled after paint (flushed synchronously if a sync update follows) | Run effect cleanups then setups | useEffect |
Because render can run multiple times or be thrown away, render code must be pure. Strict Mode (development) intentionally double-invokes component bodies, initializers and effect setup/cleanup to surface impurity.
Reconciliation Rules
- Elements of different
typeat the same position → old subtree unmounted, new mounted (state lost). - Same type → props updated, fiber reused, state kept.
- Lists are matched by
key; index keys break state when items reorder/insert. Use stable IDs. - Changing a
keydeliberately resets a component's state.
Lanes and Scheduling
React assigns each update a lane (bitmask priority):
- SyncLane: discrete events (click, keydown) and
flushSync. - InputContinuousLane: continuous events (scroll, pointermove).
- DefaultLane: updates outside events (e.g. after
fetch). - TransitionLanes: updates inside
startTransition/useTransition,useDeferredValue. - IdleLane / OffscreenLane: lowest priority, hidden content (
<Activity mode="hidden">in React 19.2).
The scheduler package runs concurrent work in roughly 5 ms slices and yields via MessageChannel (falling back to setTimeout), not requestIdleCallback. Higher-priority lanes interrupt transition renders; the interrupted work is restarted. All updates are batched automatically (React 18+), including inside promises and timeouts.
import { useState, useTransition } from 'react';
function Search({ items }: { items: string[] }) {
const [query, setQuery] = useState('');
const [filter, setFilter] = useState('');
const [isPending, startTransition
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл react-fiber-architecture?
Use when the user asks about React Fiber, reconciliation, render vs commit phase, lanes, concurrent rendering, time slicing, the React scheduler or why a component rendered twice. Produces an explanation of reconciler internals to debug render behaviour. Not for app architecture (use react-architecture) or React Three Fiber (use web3d-webgl).
Как установить скилл react-fiber-architecture?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл react-fiber-architecture запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…