redux / react-native app的根状态未定义

时间:2018-03-20 17:38:11

标签: javascript react-native redux react-redux immutable.js

当我添加此行时:import { makePages } from './pages'

我收到错误:

  

无法读取未定义

的属性'product'

信息页/ index.js

export * from './add'
export { makePages } from './model'
export * from './reducer'

信息页/ model.js

import type { RecordFactory, RecordOf } from 'immutable'
import { Record } from 'immutable'

export const makePages: RecordFactory<any> = Record({
  height: 5
})

export type Pages = RecordOf<any>

我甚至没有在文件中使用makePages,它会收到错误。

产品/ model.js

import type { RecordFactory, RecordOf } from 'immutable'
import { Record } from 'immutable'
import { makePages } from './pages'
const makeProduct: RecordFactory<any> = Record({
  pages: 3
})
let product = new makeProduct()
export { product }

为什么import { makePages } from './pages'会导致错误?

enter image description here

1 个答案:

答案 0 :(得分:0)

实际上,当我删除export * from './add'时,错误没有发生,所以我只需要确保我正确导出。可能应该单独导出所有内容而不是全部*