frontend-patterns

Implements React component, state management, and performance optimization patterns for frontend applications.

13|3|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/gqcn/lina --skill frontend-patterns-gqcn
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: frontend-patterns
Source: https://github.com/gqcn/lina/tree/main/.agents/skills/frontend-patterns
Command: npx skills add https://github.com/gqcn/lina --skill frontend-patterns-gqcn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend developers often reinvent solutions for common challenges like component composition, async data fetching, form validation, and list performance, leading to inconsistent and hard-to-maintain code. ## Core Features & Use Cases - Component Patterns: Provides composition, compound components, and render props patterns for building flexible React UIs. - State & Data Fetching: Includes custom hooks (useToggle, useQuery, useDebounce) and Context + Reducer state management implementations. - Performance & Accessibility: Covers memoization, code splitting, list virtualization with @tanstack/react-virtual, keyboard navigation, and focus management. - Use Case: When building a dashboard with a long scrollable market list, apply the virtualization pattern with useVirtualizer and lazy-load heavy chart components to keep rendering fast. ## Quick Start Ask the assistant to apply the frontend-patterns skill to refactor a React component using composition, memoization, and accessible keyboard navigation.

Frequently Asked Questions about frontend-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize React list rendering performance?▼

Use list virtualization with @tanstack/react-virtual to render only visible rows in long lists. Combine it with React.memo on row components and useMemo for derived data like sorted arrays to avoid unnecessary re-renders.

How to manage state in React without external libraries?▼

Use the Context + Reducer pattern: define a reducer with typed actions, create a context provider with useReducer, and expose a custom hook like useMarkets. This handles moderate state complexity without adding dependencies like Zustand.

What is the difference between compound components and render props?▼

Compound components share implicit state through context, as in the Tabs and Tab example, giving a declarative API. Render props pass data explicitly through a function child, as in DataLoader, offering more control over rendering logic.

Does React.lazy work with any component?▼

React.lazy works with default-exported components loaded via dynamic import and must be wrapped in Suspense with a fallback UI. It suits heavy components like charts or 3D backgrounds but adds a loading delay on first render.

Why does my React form validation not show errors?▼

Errors only appear if validation runs on submit and the errors state is rendered next to each field. Ensure validate() sets an errors object keyed by field name and each input conditionally renders its corresponding error message.

When should I use useCallback and useMemo in React?▼

Use useCallback for functions passed to memoized child components to prevent re-renders, and useMemo for expensive computations like sorting large arrays. Avoid them for cheap operations, since the memoization overhead can exceed the savings.