2
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?

Reactバージョン19では、Recoilが使えない。

Posted at

はじめに

Reactの学習中にRecoilの話が出てきて、コーディングしてたら、動かなくなってしまった。

問題

結論として、**Reactバージョン19では、Recoilが使えない。**ということです。
この記事にも書いてありました。

解決方法

解決方法としては何パータンかあり、Zustand / Jotai などのライブラリを使うのがいいかもしれないです。

他にはバージョンを落とすのも良さそうです。

# 1) React  18 に固定
npm i -E react@18.3.1 react-dom@18.3.1

# 2) TypeScript を使っている場合
npm i -D -E @types/react@18.3.11 @types/react-dom@18.3.3

# 3) キャッシュを念のためクリアして再起動
rm -rf node_modules/.vite
npm run dev

おわりに

別のライブラリを検討するのがいいかなと思います。Recoilの開発はあまり期待できなさそうです。

参考

https://zenn.dev/nappa/articles/56df3129f2592b
https://zenn.dev/kirik/scraps/d8a27d00bbb11c
https://tech.revcomm.co.jp/impact-of-react19-on-related-libraries

2
0
0

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
2
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?