Skip to content
cccskills
FreePublished on GitHub

nextjs-16-migration

Migrate from Next.js 15 to Next.js 16 and handle breaking changes

The English summary is being prepared. Showing the original description.

See how to install

Files included (1)

  • SKILL.md2.8 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Next.js 16 Migration Skill

Migrate from Next.js 15 to Next.js 16 and handle breaking changes in this portfolio.

When to use this skill

  • Upgrading Next.js version
  • Fixing Next.js 16 breaking changes
  • Migrating from Pages Router to App Router
  • Handling React 19 changes

Current versions

  • Next.js: 16.2.9
  • React: 19.2.3
  • React DOM: 19.2.3
  • @opennextjs/cloudflare: 1.19.11

Breaking changes in Next.js 16

1. proxy.ts → middleware.ts

  • Cause: OpenNext detects proxy.ts as Node.js middleware
  • Fix: Rename src/proxy.ts to src/middleware.ts

2. --dangerouslyUseUnsupportedNextVersion

  • Cause: OpenNext doesn't officially support Next.js 16 yet
  • Fix: Add flag to build command in CI/CD

3. React 19 changes

  • useFormStatus hook added
  • useOptimistic hook added
  • use hook for promises
  • Ref as prop (no forwardRef needed)
  • Cleanup functions for refs
  • useContext → use(Context)

4. App Router changes

  • loading.tsx → loading.js (extension change)
  • error.tsx → error.js (extension change)
  • not-found.tsx → not-found.js (extension change)

5. Caching changes

  • fetch requests are no longer cached by default
  • Use cache: 'force-cache' for static data
  • Use cache: 'no-store' for dynamic data

6. Metadata API changes

  • openGraph → opengraph
  • twitter → x

Migration steps

1. Update package.json

{
  "dependencies": {
    "next": "16.2.9",
    "react": "19.2.3",
    "react-dom": "19.2.3"
  }
}

2. Run migration

npx @next/codemod@latest upgrade

3. Fix TypeScript errors

npx tsc --noEmit

4. Fix ESLint errors

npm run lint

5. Test build

npm run build

6. Fix runtime errors

npm run dev

Common issues

"Invalid hook call"

  • Cause: Multiple React instances
  • Fix: Check for duplicate React in node_modules

"Cannot read property 'useState' of null"

  • Cause: React not imported correctly
  • Fix: Ensure import React from 'react' or import { useState } from 'react'

"Server Components cannot be rendered as Client Components"

  • Cause: Missing 'use client' directive
  • Fix: Add 'use client' at top of component file

"Hydration mismatch"

  • Cause: Server and client render different content
  • Fix: Use useEffect for client-only code, or suppressHydrationWarning

Checklist

  • Next.js version updated to 16.x
  • React version updated to 19.x
  • proxy.ts renamed to middleware.ts
  • --dangerouslyUseUnsupportedNextVersion flag added
  • TypeScript errors fixed
  • ESLint errors fixed
  • Build succeeds
  • Runtime errors fixed

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Audit and fix accessibility issues across the portfolio to ensure WCAG 2.1 AA compliance.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 22, 2026

Creates a new blog post document in the Sanity studio. Use when the user wants to write a blog post, publish an article, or schedule a future post.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 22, 2026

Creates a new certification document in the Sanity studio. Use when the user wants to add a credential, certificate, or professional accreditation to the Certifications collection.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 22, 2026

Adds a new skill MD file to the studio's skills collection. Use when the user wants to author a new step-by-step recipe for the studio's in-app Skills tool or the .agents mirror.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 22, 2026

Creates a new project document in the Sanity studio. Use when the user wants to add a new portfolio project, a case study, or a work sample to the Projects collection.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 22, 2026

Creates a new experience document in the Sanity studio. Use when the user wants to add a job, role, internship, or work history entry to the Experience collection.

The English summary is being prepared. Showing the original description.

PP-Namias/Portfolio2Updated Oct 22, 2026

See all skills by PP-Namias

Report a problem with this skill