Immutablejs记录不是记录

时间:2018-07-16 04:35:08

标签: reactjs redux react-redux immutable.js

在下面的代码中,当我console.log状态时,inspect就是:

state.product.inspect
ƒ () {
      return this.toString();
    }

和inspect.showProductReports未定义。为什么?

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

type ShowProductReportsProps = {
  value: boolean
  }

  export const makeShowProductReports: 
  RecordFactory<ShowProductReportsProps> = Record({
    value: false
  })

  export type ShowProductReports = RecordOf<ShowProductReportsProps>

type InspectProps = {
  showProductReports: ShowProductReports
}

export const makeInspect: RecordFactory<InspectProps> = Record({
  showProductReports: new makeShowProductReports()
})

export type Inspect = RecordOf<InspectProps>

type ProductComponentProps = {
  add: any,
  search: any,
  edit: any,
  inspect: any
}

export const makeProduct: RecordFactory<ProductComponentProps> = Record({
  add: new makeAdd(),
  search: new makeSearch(),
  edit: new makeEdit(),
  inspect: new makeInspect()
})

0 个答案:

没有答案