変更ごとに非正規化を回避するために denormalizr でreselectを使用していますが、これが本当に何かを改善しているかどうかはわかりません。
import { createSelector } from 'reselect'
import { denormalize } from 'denormalizr'
import { challenge as schema } from './challenge.schema'
const getState = (state) => state
export const getChallenge = createSelector(getState, ({ entities, challenge }) => {
return denormalize(entities.challenges[challenge.item], entities, schema)
})
export const getChallenges = createSelector(getState, ({ entities, challenge }) => {
return challenge.items.map((id) => denormalize(entities.challenges[id], entities, schema))
})