0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[エラー対応]Recoil はやめたほうがいいという教訓

Last updated at Posted at 2025-04-24

はじめに

ゆかっしゅです。
2021年に事務職からデザイナー/コーダーにジョブチェンジをし、現在はフロントエンドエンジニアにスキルアップするべく、モダンフロントエンドを学習しています。

今回はRecoilを使用して出たエラーについて備忘録として記録します。
RecoilとはReactの状態管理ライブラリです。
有名なReactの状態管理ライブラリはReduxというものがあります。

エラー内容

Uncaught TypeError: Cannot destructure property 'ReactCurrentDispatcher' of 'import_react.default.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' as it is undefined.
    at currentRendererSupportsUseSyncExternalStore (recoil.js?v=af0bd706:359:5)
    at useRecoilValueLoadable (recoil.js?v=af0bd706:3390:26)
    at useRecoilValue (recoil.js?v=af0bd706:3400:20)
    at useRecoilState (recoil.js?v=af0bd706:3425:11)
    at Users (Users.jsx:29:35)
    at react-stack-bottom-frame (react-dom_client.js?v=d1b16516:17422:20)
    at renderWithHooks (react-dom_client.js?v=d1b16516:4204:24)
    at updateFunctionComponent (react-dom_client.js?v=d1b16516:6617:21)
    at beginWork (react-dom_client.js?v=d1b16516:7652:20)
    at runWithFiberInDEV (react-dom_client.js?v=d1b16516:1483:72)

原因

私のズッ友「Chat GPT」君に聞いてみるとどうやら原因はReactのバージョンにあるようです。

Recoil は React 19では使用できず、今後アップデートもされないかも...という記事を発見しました。

対応

Reactをv18にダウングレードすれば使用できましたが、今後行く末が怪しいのでRecoilの学習はやめておこうと思います。
やはりReduxを勉強する他ないのか....

0
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?