Check out example codes for "What does inject in ruby do". It will help you in understanding the concepts better.

Code Example 1

[3, 6, 10].inject {|sum, number| sum + number} =>|3, 6| 3 + 6 => 9                                               =>|9, 10| 9 + 10 =>19

Code Example 2

[3, 6, 10, 13].inject(:+) => (((3 + 6) + 10) + 13) => 32

Learn ReactJs, React Native from akashmittal.com