All Frameworks

React Rules

4 rules available

REACT
94%

React Component Testing with Testing Library

Test behavior over implementation. Use Testing Library queries to interact with components as users would.

testingreacttesting-library
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { LoginForm }...
Jan 28, 2024by Kent C. Dodds
View Rule
REACT
96%

React Server Components Data Fetching Patterns

Master async/await patterns in Server Components for efficient data loading and caching.

reactserver-componentsdata-fetching
import { db } from '@/lib/db';
import { cache } from 'next/cache';
import { Suspense } from 'react';
import { Skeleton } from '@/components/ui/skeleto...
Feb 10, 2024by React Team
View Rule
REACT
95%

React Performance Optimization Patterns

Use React.memo, useMemo, and useCallback correctly to prevent unnecessary re-renders.

reactperformanceoptimization
import React, { useState, useMemo, useCallback, memo, useEffect } from 'react';

// Expensive calculation helper
function calculateExpensiveValue(item...
Jan 25, 2024by Dan Abramov
View Rule
REACT
96%

React Form Handling with React Hook Form

Build performant forms with React Hook Form using uncontrolled components and validation.

reactformsreact-hook-form
import { useForm, Controller } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
import DatePick...
Mar 22, 2024by Beier(Bill) Luo
View Rule