Output is not showing in the browser while using map method but it is showing while calling elements one by one from array. Answer please
const App = () => {
const items = [
{
title:"University Expenses",
amount:267
},
{
title:"Car Insurance",
amount:1200
},
{
title:"Bike Expenses",
amount:5000
}
]
return(
<>
{items.map(( val , i )=>{
<ExpenseItem key={i} title = {val.title} amount = {val.amount}/>
})}
</>
)
}
Code of ExpenseItem component
import React from "react";
const ExpenseItem = (props) => {
return (
<>
<div className="expense_div">
<h2>{props.title}</h2>
<div>
<button>${props.amount}</button>
</div>
</div>
</>
)
};
export default ExpenseItem