nextjs - 💡(How to fix) Fix Multiple react instances in Pages router with Turbopack and Next.js v16 [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#88642Fetched 2026-04-08 02:04:14
View on GitHub
Comments
3
Participants
3
Timeline
11
Reactions
1
Author
Timeline (top)
commented ×3labeled ×2closed ×1issue_type_added ×1

Error Message

  1. See error on screen After upgrading Next.js from version 15.5.9, to version 16.1.2, pages router stopped working correctly throwing error Cannot read properties of null (reading 'useContext')

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Fri Dec  5 23:12:37 PST 2025; root:xnu-12377.80.260.0.1~42/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 14
Binaries:
  Node: 20.19.5
  npm: 11.0.0
  Yarn: N/A
  pnpm: 1N/
Relevant Packages:
  next: 16.1.2
  eslint-config-next: N/A
  react: 19.2.8
  react-dom: 19.2.8
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/nsajdok/multiple-react-instances

To Reproduce

  1. Start the application in development mode
  2. Open in browser http://localhost:3000/pages-router
  3. See error on screen

Cannot read properties of null (reading 'useContext')

Current vs. Expected behavior

Current behavior: After upgrading Next.js from version 15.5.9, to version 16.1.2, pages router stopped working correctly throwing error Cannot read properties of null (reading 'useContext')

App Router works perfectly fine with both Nextjs versions v15 and v16. Problem exist only with v16

Expected behavior: Both, App Router and Pages Router works fine with Turbopack in dev mode with Next.js v16

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Fri Dec  5 23:12:37 PST 2025; root:xnu-12377.80.260.0.1~42/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 14
Binaries:
  Node: 20.19.5
  npm: 11.0.0
  Yarn: N/A
  pnpm: 1N/
Relevant Packages:
  next: 16.1.2
  eslint-config-next: N/A
  react: 19.2.8
  react-dom: 19.2.8
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Module Resolution

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

My app uses shared package with @apollo/client. The app install @apollo/client as well what probably cause the issue with multiple React instances.

That setup is working fine with Webpack with Next v15 and v16.

extent analysis

TL;DR

The issue can be resolved by ensuring that only one instance of React is used throughout the application, potentially by removing the duplicate installation of @apollo/client or configuring it to use the shared instance.

Guidance

  • Verify that the @apollo/client package is not installed twice (once in the shared package and once in the main app) to avoid multiple React instances.
  • Check the node_modules directory to ensure that there are no duplicate React installations.
  • Consider using a tool like npm dedupe or yarn dedupe to remove duplicate packages.
  • Review the Next.js configuration to ensure that it is set up to work with Turbopack in dev mode.

Example

No code snippet is provided as the issue is related to package configuration and not a specific code error.

Notes

The issue seems to be related to the change from Webpack to Turbopack in Next.js v16, which may have different handling of duplicate packages. The fact that the App Router works fine with both versions suggests that the issue is specific to the Pages Router.

Recommendation

Apply workaround: Remove or configure the duplicate @apollo/client installation to use the shared instance, as this is likely causing the multiple React instances issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Multiple react instances in Pages router with Turbopack and Next.js v16 [3 comments, 3 participants]