DEV Community

Discussion on: JavaScript concepts to write better React code

Collapse
 
icyjoseph profile image
Joseph • Edited

reduce belongs to the Fold family and it's a powerful tool for structural transformations. However it is prone to increasing cognitive load when reviewing or simply reading code, see this video, when often a double pass with filter and map does just as well in performance as reduce, see this summary, while keeping cognitive load low. Also remember that JS is compiled, and some optimizations may happen to the code.

Collapse
 
nuel_ikwuoma profile image
nuel ikwuoma

I'd definitely check those out. Thanks for contributing