1

I'm using redux-immutable and need to connect() multiple property in my component.

this is gameStore reducer initialState:

const initialState = Immutable.fromJS({
    isPlaying: null,
    level: 0,
    remainTime: 120,
    nextLevelUp: 40 ,
    requiredGoods: CROISSANT_CHOCOLATE,
    score: 0,
    renderingObjects : [],
})

and component connect():

@connect((state) => ({
        renderingObjects: state.getIn(['gameStore', 'renderingObjects']).toJS(),
        isPlaying: state.getIn(['gameStore', 'isPlaying']).toJS(),
    }
))

But getting error:

Uncaught TypeError: Cannot read property 'toJS' of null

What's wrong with that?

Emad Emami
  • 6,089
  • 3
  • 28
  • 38
  • Is `gameStore` null? I'd try logging it right there. I don't see `gameStore` in `initialState`. So maybe just try `state.getIn(['renderingObjects']).toJS()`. – Cymen Nov 27 '17 at 15:41

0 Answers0