Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

react

БесплатноБез исполняемых скриптовНе проверен

Builds and debugs React user interfaces: components, state, effects, forms and data loading, written the way React 19 expects. Use when someone asks to…

TerminalSkillsот TerminalSkills★ 221 звезда на GitHub

Об этом скилле

React — Components, State and Effects for React 19

Overview

React 19.3 (September 2026) is the current release. React 19.0 added Actions, use and ref as a prop and removed long-deprecated APIs; 19.2 added useEffectEvent and <Activity>; 19.3 made <ViewTransition> and Fragment refs stable. React Compiler 1.0 memoises components at build time. This skill covers project setup, the APIs to write today, the effect and state mistakes that cause most bugs, the server/client boundary, and testing.

Instructions

Start a project

npm create vite@latest booking-desk -- --template react-compiler-ts --eslint   # client-rendered app
npx create-next-app@latest          # Server Components and server rendering
npx create-react-router@latest      # React Router framework mode

Create React App has been deprecated since February 2025; do not use it for new apps. The TypeScript templates for Vite are react-ts and react-compiler-ts. They lint with Oxlint unless --eslint is passed, which adds eslint-plugin-react-hooks with reactHooks.configs.flat.recommended.

Write React 19, not React 18

Older pattern React 19
forwardRef((props, ref) => …) ref is an ordinary prop of function components
<ThemeContext.Provider value={…}> <ThemeContext value={…}>
useContext(ThemeContext) before any early return use(ThemeContext), allowed after a condition or early return
useFormState from react-dom useActionState from react
useRef<HTMLDivElement>() useRef<HTMLDivElement>(null); the argument is required
ref={(el) => (node = el)} ref={(el) => { node = el }}; a returned function is a cleanup
propTypes, defaultProps on functions ignored; use TypeScript types and default parameters
ReactDOM.render, ReactDOM.hydrate createRoot, hydrateRoot from react-dom/client
act from react-dom/test-utils act from react
global JSX.Element React.JSX.Element

To upgrade, install [email protected] first to see the warnings, then run the codemods:

npx codemod@latest react/19/migration-recipe
npx types-react-codemod@latest preset-19 ./src

Memoise with the compiler, not by hand

  • With the compiler on, write new code without useMemo, useCallback and memo. Add one only where a value must keep its identity, for example when it is an effect dependency.
  • In existing code, leave manual memoisation in place; removing it changes what the compiler produces.
  • The compiler skips a component that breaks the Rules of React and keeps compiling the rest; the lint rules report which ones. "use no memo" as the first statement of a component opts it out.
  • Pin the version (npm i -D --save-exact babel-plugin-react-compiler) when test coverage is thin.

Submit forms with Actions

import { useActionState } from 'react'
import { useFormStatus } from 'react-dom'
import { createBooking } from './api'

type FormState = { guestName: string; nights: number; error?: string; bookingId?: string }

async function submitBooking(_prev: FormState, formData: FormData): Promise<FormState> {
  const values = { guestName: String(formData.get('guestName') ?? '').trim(), nights: Number(formData.get('nights')) }
  if (!values.guestName) return { ...values, error: 'Guest name is required' }
  if (!Number.isInteger(values.nights) || values.nights < 1) return { ...values, error: 'Nights must be 1 or more' }
  try {
    const booking = await createBooking(values)
    return { guestName: '', nights: 1, bookingId: booking.id }
  } catch (err) {
    return { ...values, error: err instanceof Error ? err.message : 'Booking failed' }
  }
}

function SubmitButton() {
  const { pending } = useFormStatus() // status of the parent <form>
  return <button disabled={pending}>{pending ? 'Booking…' : 'Book room'}</button>
}

export function BookingForm() {
  const [state, formAction] = useActionState(submitBooking, { guestName: '', nights: 1 })
  return (
    <form action={formAction}>
      <label>Guest name <input name="guestName" defaultValue={state.guestName} /></label>
      <label>Nights <input name="nights" type="number" defaultValue={state.nights} /></label>
      <SubmitButton />
      {state.error && <p role="alert">{state.error}</p>}
      {state.bookingId && <p role="status">Booked {state.bookingId}</p>}
    </form>
  )
}
  • React resets uncontrolled fields whenever the action returns without throwing, including when it returns an error. Return the submitted values and feed them to defaultValue, as above, or the user loses what they typed.
  • useFormStatus reports on a <form> above the component that calls it, never on a form rendered by that same component.
  • Return expected failures as state. An error thrown from an action goes to the nearest error boundary.
  • useActionState returns [state, dispatch, isPending]. Outside a form, call dispatch inside startTransition.

Show optimistic

Полный SKILL.md на GitHub

Установить react в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

_scores.json

FAQ

Что делает скилл react?

Builds and debugs React user interfaces: components, state, effects, forms and data loading, written the way React 19 expects. Use when someone asks to "create a React app", "build a React component", "fix a useEffect bug", "stop unnecessary re-renders", "upgrade to React 19", "turn on the React Compiler", "use Server Components", "handle a form with Actions" or "test a React component". Covers Actions, use, useActionState, useOptimistic, ref as a prop, Server and Client Components, Suspense, error boundaries, keys, and project setup with Vite now that Create React App is deprecated.

Как установить скилл react?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл react запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить react с