31
dadoC
7y

Just refactored this only for the sake of my eyes..

Comments
  • 8
    Nice job, but why the seemingly useless variable assignment?
  • 2
    @anroven you're right, changed it!
  • 4
    @aktane the final result is practically one line
  • 2
    Shouldn't you keep that first if statement?
  • 2
    @shellbug I could, but the reducer has a default initial state to be an empty array, so it is not necessary
  • 3
    @DiegoCaceres oh, cool. I didn't notice the redux tag. I guess that's a selector then?
  • 1
    @shellbug yes! That's it :)
  • 0
    Nice refactor! 😎
    But it depends on the length of the array.
    After all last i've checked the for-loop has the best performance than all the other loops.

    Also assuming the browser will automatically choose the for-loop, there is still the case in which the object 'list.allIds' is not an array and subsequently the code will fail.
Add Comment