Hi Guys I am new in react i am creating one burger builder app for practice i don't undestand the following code, can any one give the simple alternative for this code?
props.ingredients: {
salad: 0,
eggs: 0,
cheese: 0,
meat: 0
},
let ingredientList = Object.keys(props.ingredients)
.map(igKey => {
return [...Array(props.ingredients[igKey])].map((_, i) => {
return <BurgerFilling key={igKey + i} type={igKey} />
});
})
.reduce((rootArray, currEl) => {
console.log('rootArray>>>', rootArray, currEl);
return rootArray.concat(currEl);
}, []);