latest-nextjs
Latest React and Next.js features for past 1.5 years (mid-2024 to 2026)
What this skill does
# Latest React & Next.js Skill
Comprehensive knowledge of React and Next.js features from mid-2024 through 2025. This skill fills the gap between LLM training cutoffs and current knowledge, covering **React 19.2** (October 2025), **Next.js 16** (October 2025), and supporting ecosystem changes.
## React 19.2 (Latest - October 2025)
### Current Status
- **Latest stable version**: React 19.2 (released October 1, 2025)
- **Previous updates**: React 19.1 (March 2025 - refinement release)
- **Initial release**: React 19 (December 2024)
### Key Improvements in 19.1-19.2
- No breaking changes from 19.0
- Performance optimizations
- Enhanced DevTools features
- 30-40% smaller JavaScript bundle sizes
- Faster TTFB (Time to First Byte)
## React 19 Core Features
### New Hooks
#### `useOptimistic`
Manages optimistic UI updates during async mutations:
```tsx
import { useOptimistic } from "react";
function LikeButton({ postId, initialLiked }) {
const [optimisticLiked, addOptimistic] = useOptimistic(
initialLiked,
(state, newLiked) => !state
);
async function handleToggle() {
addOptimistic(!optimisticLiked);
await toggleLike(postId);
}
return (
<button onClick={handleToggle}>
{optimisticLiked ? "Unlike" : "Like"}
</button>
);
}
```
**Use cases**: Like buttons, todo lists, any UI showing predicted state during server updates.
#### `useActionState`
Connects forms to action functions and tracks response state:
```tsx
import { useActionState } from "react";
const [state, formAction, isPending] = useActionState(
async (prevState, formData) => {
const email = formData.get("email");
await subscribe(email);
return { success: true, message: "Subscribed!" };
},
null
);
```
**Replaces**: Manual form state management, loading states, error handling.
#### `useFormStatus`
Accesses parent form status from nested components:
```tsx
import { useFormStatus } from "react";
function SubmitButton() {
const { pending, data, method, action } = useFormStatus();
return (
<button disabled={pending}>{pending ? "Sending..." : "Submit"}</button>
);
}
```
**Key use case**: Submit buttons that need parent form state.
#### Enhanced `useTransition`
Now supports async functions with automatic state management:
```tsx
const [isPending, startTransition] = useTransition();
startTransition(async () => {
// Automatic pending, error, and optimistic UI handling
await searchAPI(query);
});
```
#### New `use` Hook
Reads resources (Promises, Context) in render:
```tsx
import { use } from "react";
// Read promises in Server Components
const data = use(fetchPromise);
// Read context
const theme = use(ThemeContext);
```
**Use case**: Streaming data in Server Components without useEffect.
### Server Components (Stable)
Production-ready and used at scale by Meta (Facebook, Instagram):
```tsx
// Server Component - runs on server only
async function BlogPost({ id }) {
const post = await db.post.findUnique({ where: { id } });
return <article>{post.content}</article>;
}
```
**Key characteristics:**
- Zero JavaScript bundled to client
- Direct database access
- Build-time or per-request rendering
- Next.js defaults to Server Components
### React Compiler (Stable Integration with Next.js 16)
Automatically optimizes components without manual memoization:
**Before:**
```tsx
const memoizedValue = useMemo(() => expensiveCalc(a, b), [a, b]);
const memoizedCallback = useCallback(() => doSomething(a, b), [a, b]);
```
**With Compiler:**
```tsx
// Compiler automatically optimizes
const value = expensiveCalc(a, b);
const callback = () => doSomething(a, b);
```
**Capabilities:**
- Eliminates need for useMemo/useCallback in most cases
- Automatic re-render optimization
- Integrated and stable in Next.js 16
### Server Functions (formerly Server Actions)
Simplified server-side mutations:
```tsx
// app/actions.ts
"use server";
export async function updateProfile(formData: FormData) {
const name = formData.get("name");
await db.user.update({ where: { id }, data: { name } });
}
// Client Component usage
import { updateProfile } from "./actions";
export default function ProfileForm() {
return (
<form action={updateProfile}>
<input name="name" />
<button type="submit">Update</button>
</form>
);
}
```
### Simplified Forms
React 19 eliminates much of the complexity:
```tsx
// No more controlled state needed
export default function ContactForm() {
return (
<form
action={async (formData) => {
await submitToServer(formData);
}}
>
<input name="email" />
<button type="submit">Submit</button>
</form>
);
}
```
### API Simplifications
#### Context Providers - No More `.Provider`
```tsx
// Before
<MyContext.Provider value={value}>{children}</MyContext.Provider>
// React 19+
<MyContext value={value}>{children}</MyContext>
```
#### Ref as Prop - No More `forwardRef`
```tsx
// Before
const Button = forwardRef((props, ref) => <button ref={ref} {...props} />);
// React 19+
const Button = ({ ref, ...props }) => <button ref={ref} {...props} />;
```
### Document Metadata Support
Place `<title>`, `<meta>`, `<link>` directly in components:
```tsx
function BlogPost({ title, description }) {
return (
<>
<title>{title} | My Blog</title>
<meta name="description" content={description} />
<meta property="og:title" content={title} />
<article>{content}</article>
</>
);
}
```
React automatically "hoists" these to `<head>`.
### Enhanced Ref Callbacks
Ref callbacks can now return cleanup functions:
```tsx
const buttonRef = useCallback((element: HTMLButtonElement | null) => {
if (!element) return; // cleanup on unmount
const handler = () => console.log("Clicked");
element.addEventListener("click", handler);
return () => element.removeEventListener("click", handler);
}, []);
```
### Improved Hydration
- Better handling of third-party script DOM mutations
- Enhanced error messages with detailed diffs
- Consolidated error logging
### New Error Callbacks
```tsx
createRoot(document.getElementById("root")!, {
onCaughtError: (error, errorInfo) => {
// Errors caught by Error Boundaries
console.error("Caught:", error, errorInfo);
},
onUncaughtError: (error, errorInfo) => {
// Errors NOT caught by Error Boundaries
console.error("Uncaught:", error, errorInfo);
},
});
```
### Custom Elements Support
Full support for Web Components with proper attribute and event handling.
## Next.js 16 (Released October 2025)
### Major Changes
#### Turbopack - Now Default & Stable
Turbopack is now the default bundler for both `next dev` and `next build`:
```bash
# Turbopack is now default - no flags needed
next dev
next build
```
**Performance improvements:**
- 5-10x faster Fast Refresh
- Significantly faster builds
- Production-ready stability
#### Cache Components (New Programming Model)
**Cache Components** replace Partial Prerendering (PPR) with a more explicit caching model:
```tsx
// next.config.js - Enable Cache Components
export default {
cacheComponents: true, // Opt-in feature
};
```
**Key characteristics:**
- More explicit and flexible than implicit App Router caching
- Requires opt-in via config flag
- Component-level caching control
- Supersedes experimental PPR from Next.js 15
#### `proxy.ts` Replaces `middleware.ts`
Middleware has been renamed to **proxy**:
```tsx
// Before: middleware.ts
export function middleware(request: NextRequest) {
// logic
}
// After: proxy.ts
export function proxy(request: NextRequest) {
// Same logic, just renamed
}
```
**Migration:**
```bash
# Automated codemod available
npx @next/codemod@canary middleware-to-proxy
```
**What changed:**
- File renamed: `middleware.ts` → `proxy.ts`
- Export renamed: `middleware` → `proxy`
- Logic remains identical
- Runs on Node.js runtime
#### Async Route Parameters (Breaking Change)
Route parametRelated in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.