I have a react component, and I need debug the value of 'customer' element that 'map' produce "customers.map( customer =>".
I've tried before "" this
{ console.log (customer)}
but i get error, here the component:
const CustomersList = ({ data: {loading, error, customers }}) => {
if (loading) {
return <p style={{color:"red"}}>Loading ...</p>;
}
if (error) {
return <p>{error.message}</p>;
}
return (
<div>
Customers List
{ customers.map( customer =>
(<div key={customer.id} >Hey {customer.firstname}</div>)
)}
</div>
);
};