Reputation: 49
I am making a function that will render the information of fees in each installment(key is equal to installment1, card[1][key] is the value, like a float 2.5), but my function is not returning! The console.log is working perfectly, anyone can give me an insight?!
export function returnInstallmentsWithFee(card, fee) {
Object.keys(card[1]).forEach(function (key) {
console.log('test', key, card[1][key])
return (
<div>
{key}:{card[1][key]}
</div>
)
})
}
Upvotes: 0
Views: 112
Reputation: 5380
returnInstallmentsWithFee
) doesn't have a return satatement;forEach
doen't return anything, you may want to use .map()
export function returnInstallmentsWithFee(card, fee) {
return Object.keys(card[1]).map(function (key) {
console.log('test', key, card[1][key])
return (
<div>
{key}:{card[1][key]}
</div>
)
})
}
Upvotes: 3