Appointment Planner Challenge Project (React)

Hi there,

Please help, I’m stuck.
I try to add a contact but I keep getting this error message:

’ Objects are not valid as a React child (found: object with keys {name, phone, email}). If you meant to render a collection of children, use an array instead’

I’m using the function that is in the solution:

const addContact = (name, phone, email) => {
setContacts([…contacts, { name: name, phone: phone, email: email, },]);
};

and I’m calling it like this:

addContact(name, phone, email);

What’s wrong with this?

Thanks!

2 Likes