Right now I'm using reselect to create my selectors to extract data from the store and pass it to the props via connect.
For simplicity, the result of my selectors is always a JS object (calling toJS() at the end of the selector), something like this:
const selector = state => state.get('data').toJS();
Now I'm trying to improve some performance and I realized that shouldComponentUpdate shallow comparison loses the advantages of immutability because of the way I'm returning from my selectors.
On the other hand, using .get('prop') inside my html seems extremely annoying:
<div>{this.props.data.get('prop')}</div>
Especially if I have a case of passing a simple JS object to a child component which is mutable, like this:
<ChildComponent totalItems={10} />
And then there is no consistency when accessing the props (some are mutable and some are immutable).
I thought of creating an helper unwrap function, something like this:
const unwrap = obj => obj && obj.toJS ? obj.toJS() : obj;
But I don't really like this solution.. I don't really like any of those approaches.
What do you use for both clean code & performance?