Can anyone explain how store action creator and reducer works its little difficult to understand | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can anyone explain how store action creator and reducer works its little difficult to understand

11th Sep 2020, 5:53 AM
Shivam Rawal
2 Answers
+ 1
Basically, Reduce method performs a reduction function (provided by you), going through the entire array, and returning its respective object, item or array. Basic structure: const finalObject = items.reduce((finalObject, item) => { / * Logic for return * / finalObject.adderItens + = item.subItem return finalObject }, {adderItens: 0}) Note: subItem is an element pre-existing items. For better understand content, I recommend the Digital Innovation One course: https://digitalinnovation.one/cursos/desmistificados-map-filter-e-reduce?ref=certificate/9D6DB7CC Hope I have helped and good studies.
21st Sep 2020, 1:06 PM
Lauany Reis da Silva
Lauany Reis da Silva - avatar
0
Tysm
21st Sep 2020, 3:25 PM
Shivam Rawal