createSelectorCreator Not Working
I am trying to create a selector that uses a deep equality check. However, when I feed in a the lodash equality check, it doesn't seem to be working! I just copy and pasted the code you suggested:
import { createSelector, createSelectorCreator, defaultMemoize } from 'reselect'
import { isEqual } from 'lodash'
const createDeepEqualSelector = createSelectorCreator(
defaultMemoize,
isEqual
)
export const ccNumSelect = createDeepEqualSelector( state => {
const rawCCNumber = payAddressSelect(state, 'rawCCNumber')
if (rawCCNumber) {
return rawCCNumber.replace(/[^\d]/g, '')
}
return ''
})
When my state updates, I don't see it going into my ccNumSelect method at all; it only happens upon initialization. I am using redux-form but I don't think that should matter. Any idea what's going on?
@ellbee Well I tried reverting to version 2.5.4 and it's not working still. So I guess it's not the new version. Any idea what could be going on?
Hey @Sangeli, if you can provide me with a working example I can run which demonstrates the problem I'll take a look for you.
I think if you use multiple functions inside the createDeepEqualsSelector, it will work. It will deep compare the value returned from the first function(s). I'm still playing around with this myself, and was actually googling for the answer