Do Immutable.js or Lazy.js perform short-cut fusion?

I’m the author of Immutable.js (and a fan of Lazy.js). Does Lazy.js and Immutable.js’s Seq use short-cut fusion? No, not exactly. But they do remove intermediate representation of operation results. Short-cut fusion is a code compilation/transpilation technique. Your example is a good one: var a = [1,2,3,4,5].map(square).map(increment); Transpiled: var a = [1,2,3,4,5].map(compose(square, increment)); Lazy.js and … Read more

Redux state is undefined in mapStateToProps

You reducer doesn’t have a default action in switch statement. Which is why even though you mentioned the initial state in reducer params, undefined is returned as store initial state import React from ‘react’; import {Map,fromJS} from ‘immutable’; const reducer = (state = Map() ,action) => { switch(action.type){ case ‘SET_STATE’: return state.merge(action.state); default: return state; … Read more

Why should I use immutablejs over object.freeze?

I don’t think you understood what immutablejs offers. It’s not a library which just turns your objects immutable, it’s a library around working with immutable values. Without simply repeating their docs and mission statement, I’ll state two things it provides: Types. They implemented (immutable) infinite ranges, stacks, ordered sets, lists, … All of their types … Read more

How to specify null prop type in ReactJS?

It is possible to use PropTypes.oneOf([null]).isRequired. It should allow null, and nothing else. You can combine that with any other type: PropTypes.oneOfType([ PropTypes.string.isRequired, PropTypes.oneOf([null]).isRequired, ]).isRequired Edit: I just had this prop type fail for me when given a null prop using prop-types 15.7.2, so I’m not sure this works anymore (if it ever did?). I … Read more