React Frontend logo

React Frontend

Community
iliaal
react-frontend

React, TypeScript, and Next.js patterns for frontend development. Use when building React components, managing state, fetching data, optimizing performance, or working with Next.js App Router. Covers React 18-19, hooks, Server Components, and type-safe patterns.

Overview

Publisheriliaal
Repositorywhetstone
Skill namereact-frontend
Stars
36
Forks
5
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by iliaal on GitHub. Read the source before you install it.

Installation

Install the React Frontend AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/iliaal/whetstone/tree/master/distillery/generated-skills/react-frontend
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/iliaal/whetstone.git /tmp/whetstone
mkdir -p .claude/skills
cp -r /tmp/whetstone/distillery/generated-skills/react-frontend .claude/skills/react-frontend
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable React Frontend in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads React Frontend on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so React Frontend is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

React Frontend

Component TypeScript

  • Extend native elements with ComponentPropsWithoutRef<'button'>, add custom props via intersection
  • Use React.ReactNode for children, React.ReactElement for single element, render prop (data: T) => ReactNode
  • Discriminated unions for variant props — TypeScript narrows automatically in branches
  • Generic components: <T> with keyof T for column keys, T extends { id: string } for constraints
  • Event types: React.MouseEvent<HTMLButtonElement>, FormEvent<HTMLFormElement>, ChangeEvent<HTMLInputElement>
  • as const for custom hook tuple returns
  • useRef<HTMLInputElement>(null) for DOM (use ?.), useRef<number>(0) for mutable values
  • Explicit useState<User | null>(null) for unions/null
  • useReducer actions as discriminated unions: { type: 'set'; payload: number } | { type: 'reset' }
  • useContext null guard: throw in custom useX() hook if context is null

Effects Decision Tree

Effects are escape hatches — most logic should NOT use effects.

NeedSolution
Derived value from props/stateCalculate during render (useMemo if expensive)
Reset state on prop changekey prop on component
Respond to user eventEvent handler
Notify parent of state changeCall onChange in event handler, or fully controlled component
Chain of state updatesCalculate all next state in one event handler
Sync with external systemEffect with cleanup

Effect rules:

  • Never suppress the linter — fix the code instead
  • Use updater functions (setItems(prev => [...prev, item])) to remove state dependencies
  • Move objects/functions inside effects to stabilize dependencies
  • useEffectEvent for non-reactive values (e.g., theme in a connection effect)
  • Always return cleanup for subscriptions, connections, listeners
  • Data fetching: use ignore flag pattern or React Query

State Management

Local UI state       → useState, useReducer
Shared client state  → Zustand (simple) | Redux Toolkit (complex)
Atomic/granular      → Jotai
Server/remote data   → React Query (TanStack Query)
URL state            → nuqs, router search params
Form state           → React Hook Form

Key patterns:

  • Zustand: create<State>()(devtools(persist((set) => ({...})))) — use slices for scale, selective subscriptions to prevent re-renders
  • React Query: query keys factory (['users', 'detail', id] as const), staleTime/gcTime, optimistic updates with onMutate/onError rollback
  • Separate client state (Zustand) from server state (React Query) — never duplicate server data in client store
  • Colocate state close to where it's used; don't over-globalize

Performance

Critical — eliminate waterfalls:

  • Promise.all() for independent async operations
  • Move await into branches where actually needed
  • Suspense boundaries to stream slow content

Critical — bundle size:

  • Import directly from modules, avoid barrel files (index.ts re-exports)
  • next/dynamic or React.lazy() for heavy components
  • Defer third-party scripts (analytics, logging) until after hydration
  • Preload on hover/focus for perceived speed

Re-render optimization:

  • Derive state during render, not in effects
  • Subscribe to derived booleans, not raw objects (state.items.length > 0 not state.items)
  • Functional setState for stable callbacks: setCount(c => c + 1)
  • Lazy state init: useState(() => expensiveComputation())
  • useTransition for non-urgent updates (search filtering)
  • useDeferredValue for expensive derived UI
  • Use ternary (condition ? <A /> : <B />), not && for conditionals
  • React.memo only for expensive subtrees with stable props
  • Hoist static JSX outside components

React Compiler (React 19): auto-memoizes — write idiomatic React, remove manual useMemo/useCallback/memo. Install babel-plugin-react-compiler, keep components pure.

React 19

  • ref as prop — forwardRef deprecated. Accept ref?: React.Ref<HTMLElement> as regular prop
  • useActionState — replaces useFormState: const [state, formAction, isPending] = useActionState(action, initialState)
  • use() — unwrap Promise or Context during render (not in callbacks/effects). Enables conditional context reads
  • useOptimistic — const [optimistic, addOptimistic] = useOptimistic(state, mergeFn) for instant UI feedback
  • useFormStatus — const { pending } = useFormStatus() in child of <form action={...}>
  • Server Components — default in App Router. Async, access DB/secrets directly. No hooks, no event handlers
  • Server Actions — 'use server' directive. Validate inputs (Zod), revalidateTag/revalidatePath after mutations

Next.js App Router

File conventions: page.tsx (route UI), layout.tsx (shared wrapper), loading.tsx (Suspense), error.tsx (error boundary), not-found.tsx (404), route.ts (API endpoint)

Rendering modes: Server Components (default) | Client ('use client') | Static (build) | Dynamic (request) | Streaming (progressive)

Decision: Server Component unless it needs hooks, event handlers, or browser APIs. Split: server parent + client child.

Routing patterns:

  • Route groups (name) — organize without affecting URL
  • Parallel routes @slot — independent loading states in same layout
  • Intercepting routes (.) — modal overlays with full-page fallback

Caching:

  • fetch(url, { cache: 'force-cache' }) — static
  • fetch(url, { next: { revalidate: 60 } }) — ISR
  • fetch(url, { cache: 'no-store' }) — dynamic
  • Tag-based: fetch(url, { next: { tags: ['products'] } }) then revalidateTag('products')

Data fetching: Fetch in Server Components where data is used. Use Suspense boundaries for slow queries. React.cache() for per-request dedup. generateStaticParams for static generation. generateMetadata for dynamic SEO.

Discipline

  • For non-trivial changes, pause and ask: "is there a more elegant way?" Skip for obvious fixes.
  • Simplicity first — every change as simple as possible, impact minimal code
  • Only touch what's necessary — avoid introducing unrelated changes
  • No hacky workarounds — if a fix feels wrong, step back and implement the clean solution

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the React Frontend AI skill do?

React, TypeScript, and Next.js patterns for frontend development. Use when building React components, managing state, fetching data, optimizing performance, or working with Next.js App Router. Covers React 18-19, hooks, Server Components, and type-safe patterns.

Why use React Frontend on TypingMind?

Because you install it once and use it with any model. React Frontend is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install React Frontend in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/iliaal/whetstone/tree/master/distillery/generated-skills/react-frontend. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use React Frontend?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with React Frontend?

As many as you like. As long as a model supports skills, you can use React Frontend with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the React Frontend AI skill free?

Yes. It is published on GitHub by iliaal under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇