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?

ReduxのcreateStoreが非推奨になった件

Last updated at Posted at 2025-06-26

時間ができたので、放置していたReact(19.1.0)の学習を進めているときに、2025/06/26現在で最新のRedux 5.0.1のパッケージを追加すると、VS Codeで以下の警告が表示された。

スクリーンショット 2025-06-26 162347.png

ちょっと調べてみると、createStoreが非推奨になったのは、Redux 4.2.0からだった。
createStoreは「非推奨(deprecated)」であって「廃止(obsolete)」ではないので、まだ使えるようだが、このような警告を放置して先に進むと、ろくなことが起きないので対処することにした。

具体的には、VS Codeのメッセージにしたがって、以下のように修正した。

  1. npm install @reduxjs/toolkit --save でRedux Toolkitパッケージを追加
  2. import { createStore } from 'redux';import { configureStore } from '@reduxjs/toolkit'; に変更
  3. createStore(rootReducer)configureStore({ reducer: rootReducer }) に変更

これで取り敢えずは警告が出なくなった。
ただし、まだ、途中なので、この先に何が起きるか分からない。

なお、今回はVite 6.3.5を使用して開発環境を作成している。
また、react-redux 9.2.0を使用してReduxをReactに連結している。

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