question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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® Core™ 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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

16reactions
TheDanielMolicommented, Apr 24, 2022

Same here, solved by downgrading to React 17.0.2

1reaction
cortinicocommented, May 19, 2022

does that mean we could only use react 18 only if react-native 0.69 is out?

Yes that’s correct 👍 You can read more on how React & React Native versions interact here: https://github.com/facebook/react-native/blob/main/Libraries/Renderer/README.md

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: dispatcher.useSyncExternalStore is not ...
This happens because react-redux is not supported yet with React 18 (React and React Native). Downgrade react-redux to the previous version ...
Read more >
TypeError: dispatcher.useSyncExternalStore is not a function
When using react 18, I get this message when building: … ... TypeError: dispatcher.useSyncExternalStore is not a function.
Read more >
React 18 & React Native
This page describes how to use React 18 with React Native using the React Native's New ... New hooks ( useId , useSyncExternalStore...
Read more >
use-sync-external-store - npm
Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.. Latest version: 1.2.0, ...
Read more >
dispatch is not a function. What am I doing wrong here? [Redux
TypeError : dispatch is not a function. ... components/Login"; import { Provider } from "react-redux"; import thunk from ... 18 days ago.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found