frontend-patterns

Implements React and Next.js patterns for components, state, performance, and accessibility.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill frontend-patterns-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: frontend-patterns
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/frontend-patterns
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill frontend-patterns-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend developers often reinvent solutions for common UI challenges like state management, data fetching, form validation, and performance optimization, leading to inconsistent and hard-to-maintain React codebases. ## Core Features & Use Cases - Component & Hook Patterns: Provides composition, compound components, render props, and reusable custom hooks like useToggle, useQuery, and useDebounce. - Performance Optimization: Covers memoization with useMemo/useCallback/React.memo, code splitting with lazy loading, and list virtualization using @tanstack/react-virtual. - Forms, Errors & Accessibility: Includes controlled form validation, error boundaries, Framer Motion animations, keyboard navigation, and focus management. - Use Case: When building a dashboard with a long scrollable list of items, apply the virtualization pattern with useVirtualizer to render only visible rows and keep the UI responsive. ## Quick Start Ask the AI to apply the frontend-patterns skill to refactor a React component for better performance and accessibility.

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 component performance with memoization?▼

Use useMemo for expensive computations like sorting lists, useCallback for functions passed to child components, and React.memo to wrap pure components. These prevent unnecessary re-renders when props and dependencies have not changed.

How to handle long lists in React without performance issues?▼

Use list virtualization with @tanstack/react-virtual's useVirtualizer hook. It renders only visible rows plus a small overscan buffer, positioning items absolutely within a scrollable container based on estimated row heights.

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

Compound components share implicit state through React Context, as in the Tabs and Tab pattern, giving a declarative API. Render props pass data explicitly via a function child, as in the DataLoader pattern, offering more flexibility per usage.

Does React Context work well for global state management?▼

Context combined with useReducer works well for moderate state like the MarketProvider pattern shown. For larger applications, libraries like Zustand may be preferable since Context re-renders all consumers on any state change.

How do I make a React modal accessible with keyboard navigation?▼

Add role="dialog" and aria-modal="true", trap focus inside the modal, close on Escape key, and restore focus to the previously focused element when closing. Save document.activeElement before opening and refocus it on close.

When should I use code splitting with React.lazy?▼

Use React.lazy with Suspense for heavy components like charts or Three.js backgrounds that are not needed on initial render. This reduces the initial bundle size, with a fallback skeleton shown while the chunk loads.