+ 3
Can anyone explain how store action creator and reducer works its little difficult to understand
2 Réponses
+ 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.
0
Tysm