Skip to content

[React native 0.68.1 + React 18] TypeError: dispatcher.useSyncExternalStore is not a function. #33696

Closed
@xiongemi

Description

@xiongemi

Description

Got TypeError: dispatcher.useSyncExternalStore is not a function error after upgrade React Native to 0.68.1 and React to 18.

If I just render the presentational component, it looks fine. As soon as I use the function connect from React-Redux, it throws an error.

Error:

TypeError: dispatcher.useSyncExternalStore is not a function. (In 'dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot)', 'dispatcher.useSyncExternalStore' is undefined)

This error is located at:
    in Connect(Search) (at App.tsx:42)

"react-redux": "8.0.1",
"redux-logger": "^3.0.6",
"@reduxjs/toolkit": "1.8.1",

Version

0.68.1

Output of npx react-native info

System:
OS: macOS 12.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 2.90 GB / 64.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.16 - ~/.nvm/versions/node/v14.17.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 28, 29, 30, 31
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.0.0
System Images: android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2021.1 AI-211.7628.21.2111.8309675
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_292 - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/javac
npmPackages:
@react-native-community/cli: 7.0.3 => 7.0.3
react: 18.0.0 => 18.0.0
react-native: 0.68.1 => 0.68.1
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

  • I got a repo working fine with React 17 and React Native 67, after I did the upgrade, it throws the above error.

Snack, code example, screenshot, or link to a repository

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: FixedA PR that fixes this issue has been merged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions