Sign in Go Pro

Beginning JavaScript for React Native

Map, Filter, Reduce





Instead of using for and while loops, many modern JavaScript programs (including React Native applications) make heavy use of the map, filter and reduce methods.

You can use map and filter to transform an array into another array, and you can use reduce to take an array and turn it into another array or object. Using map, filter and reduce is a way to clean up code, and allows you to inline bits of code, like returning a component per array object in a React Native component

Summary of Content:

  • Move from using a for loop to loop over an array to the map function
  • Use filter to filter out unwanted values from an array
  • Transform an array into an object with reduce





There are no comments on this lesson, start the conversation below ...

You need to go PRO to post comments.

Lessons in Beginning JavaScript for React Native