LoginSignup
2
1

More than 3 years have passed since last update.

【React+Redux:reducer, state】reducerを追加したのに該当のstateが定義されない時は、combineReducerを確認する

Posted at

reducer追加時はcombineReducerの確認を

reducerがstateごとに分かれているファイル構成で新しいreducerを追加した時、
該当のreducerで定義したstateが反映されないな、と思っていたところ、
combineReducerに追加したreducerを定義していませんでした。:frowning2:

reducers/index.js
  import { combineReducers } from 'redux'

  export default combineReducers({
    oldReducer,
    newReducer // この定義が抜けていました
  })

初歩的なミスでお恥ずかしいのですが、困ったのでメモしておきます。

参照URL

・上記「combineReducer」のリンク(公式)
https://redux.js.org/api/combinereducers

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