PixelogicDev / Gruvee-Mobile

#WeAreGrüvee
MIT License
48 stars 11 forks source link

[Enhancement] Use immer for complex immutable updates #30

Open itsMapleLeaf opened 4 years ago

itsMapleLeaf commented 4 years ago

Code like this could benefit from it:

return {
  ...state,
  something: {
    ...state.something,
    [someId]: {
      ...state.something[someId],
      someValue,
    }
  }
}
return produce(state, draft => {
  state.something[someId].someValue = someValue
})

https://immerjs.github.io/immer/docs/introduction

adilanchian commented 4 years ago

@kingdaro thanks for the suggestion! Tagged this as an enhancement for now as this isn't MVP blocking work, but we might be able to greatly benefit from this.