Skip to content

[email protected] breaks with React 18: "use is not exported from 'react'" #14020

@klaveriuzent

Description

@klaveriuzent

Reproduction

💥 Bug Description
When using [email protected] with [email protected], the build fails with the following error:

Attempted import error: 'use' is not exported from 'react'

📷
Image
Image

📌 Cause
This happens because [email protected] is using use() — a feature only available in upcoming React 19 — but the package’s peerDependencies still allow installing it alongside React 18, which leads to an import error during build.

System Info

System:
  OS: Windows 10 64-bit

Binaries:
  Node:  v22.13.0
  npm: v11.4.2

npmPackages:
  "react": "^18.3.1",
  "react-dom": "^18.3.1",
  "@types/react": "^19.1.8",
  "@types/react-dom": "^19.1.6",
  "typescript": "^4.9.5"

Used Package Manager

npm

Expected Behavior

Either: [email protected] should require React 19 explicitly
Or: [email protected] should not use use() if compatibility with React 18 is expected

Actual Behavior

When building with [email protected] and [email protected], the build fails with:
Attempted import error: 'use' is not exported from 'react'
This suggests react-router is using a feature not available in React 18.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions