React-Redux - No reducer provided for key “coins”

后端 未结 4 1231
天命终不由人
天命终不由人 2020-12-30 19:05

Not sure why I\'m getting the following errors.

I\'m just setting up my store, actions and reducers, I haven\'t called dispatch on anything yet.

Expected

4条回答
  •  醉梦人生
    2020-12-30 19:24

    Your issue lies with how you're importing your coins reducer:

    import { coins } from './coins'
    

    The latter tries to obtain a named export returned from the file in ./coins.

    You are not using any named exports only export default, therefore you just need to import the file as follows:

    import coins from './coins';
    

    Using the latter will result with the fact that coins will then contain the value of export default; which will be the coins reducer.

提交回复
热议问题