Skip to content

Module '"react"' has no exported member 'experimental_useOptimistic'. #57026

Closed
@grzegorzpokorski

Description

@grzegorzpokorski

Link to the code that reproduces this issue

https://github.com/grzegorzpokorski/useoptimistic-issue

To Reproduce

  1. clone repo
  2. pnpm i && pnpm lint && pnpm build
  3. you shouldn't see any errors after pnpm lint but build fails with following error:

Module '"react"' has no exported member 'experimental_useOptimistic'.

Current vs. Expected behavior

successfully build app

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
Binaries:
  Node: 18.18.2
  npm: 9.8.1
  Yarn: N/A
  pnpm: 8.9.2
Relevant Packages:
  next: 13.5.6
  eslint-config-next: 13.5.6
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

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

Not sure, ESLint (eslint-config-next)

Additional context

Recently React team removed experimantal_ prefix from some hooks facebook/react#27459.
I see that Next.js uses under hood experimental version of the React library where useOptimistic does not require prefix but at build is used stable version of React what causes error and fails build (?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    TypeScriptRelated to types with Next.js.UpstreamRelated to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions