react

v2026.09.24

React library for building user interfaces. Use when building web applications, creating components, managing state, handling side effects, or optimizing performance.

GitHub
安装命令
npx skhub add hairyf/react
Markdown
SKILL.md

React

The skill is based on React, generated at 2026-01-31.

React is a JavaScript library for building user interfaces. It lets you compose complex UIs from small and isolated pieces of code called "components". React uses a declarative paradigm that makes it easier to reason about your application and aims to be both efficient and flexible.

Core References

TopicDescriptionReference
useStateHook for managing component state with direct updatescore-usestate
useEffectHook for synchronizing components with external systemscore-useeffect
useContextHook for reading and subscribing to contextcore-usecontext
useRefHook for referencing values that don't trigger re-renderscore-useref
useReducerHook for managing complex state with a reducer functioncore-usereducer
SuspenseComponent for displaying fallback UI while content is loadingcore-suspense
memoHigher-order component for memoizing component renderscore-memo
createContextAPI for creating context objectscore-createcontext
FragmentComponent for grouping elements without wrapper nodescore-fragment
StrictModeComponent for enabling additional development checkscore-strictmode

Features

Performance Optimization

TopicDescriptionReference
useMemoHook for caching expensive calculationsfeatures-usememo
useCallbackHook for caching function definitionsfeatures-usecallback
lazyAPI for code splitting and lazy loading componentsfeatures-lazy
useTransitionHook for non-blocking state updatesfeatures-usetransition
useDeferredValueHook for deferring non-critical UI updatesfeatures-usedeferredvalue
useLayoutEffectHook that fires synchronously before browser repaintfeatures-uselayouteffect
startTransitionAPI for marking non-blocking state updatesfeatures-starttransition

Advanced Hooks

TopicDescriptionReference
useIdHook for generating unique IDs for accessibilityfeatures-useid
useAPI for reading Promise and Context valuesfeatures-use
useActionStateHook for managing form action statefeatures-useactionstate
useOptimisticHook for optimistic UI updatesfeatures-useoptimistic
useInsertionEffectHook for CSS-in-JS libraries to inject stylesadvanced-useinsertioneffect
useSyncExternalStoreHook for subscribing to external storesadvanced-usesyncexternalstore
useImperativeHandleHook for customizing ref handlesadvanced-useimperativehandle
useEffectEventHook for extracting non-reactive logic from Effectsadvanced-useeffectevent
useDebugValueHook for adding labels to custom hooks in DevToolsadvanced-usedebugvalue

React DOM APIs

TopicDescriptionReference
createRootAPI for creating a root to render React componentsreact-dom-createroot
hydrateRootAPI for hydrating server-rendered HTMLreact-dom-hydrateroot
createPortalAPI for rendering children into different DOM nodesreact-dom-createportal
flushSyncAPI for forcing synchronous updatesreact-dom-flushsync

React Server Components

TopicDescriptionReference
cacheAPI for caching function results in Server Componentsrsc-cache

Advanced Components

TopicDescriptionReference
ProfilerComponent for measuring rendering performanceadvanced-profiler
ActivityComponent for hiding and restoring UI statefeatures-activity

Testing

TopicDescriptionReference
actTest helper for applying pending updates before assertionstesting-act

Best Practices

TopicDescriptionReference
Rules of HooksFundamental rules for using React Hooks correctlybest-practices-rules-of-hooks
Component PurityRules for keeping React components and hooks purebest-practices-purity

Key Recommendations

  • Use hooks at the top level - Never call hooks conditionally or in loops
  • Keep components pure - Components should be idempotent and have no side effects during render
  • Use useEffect for side effects - Synchronize with external systems using Effects
  • Memoize expensive calculations - Use useMemo for costly computations, useCallback for functions passed to memoized components
  • Code split with lazy - Use lazy and Suspense for route-based code splitting
  • Avoid premature optimization - Profile first, optimize only when needed
  • Use React Compiler - Consider using React Compiler for automatic memoization
  • Handle dependencies correctly - Always include all reactive values in Effect and memoization dependencies
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

Sep 24, 2026

分类

未分类

许可证

MIT

源路径

skills/react

默认分支

main

最新提交

4f463c7

Tree SHA

73bcd03