0

Could anybody tell me where i am going wrong? I have a sample code here where i am mapping over an array of objects and trying to render each item but for some reason it renders the same thing the amount of times of how many items I have. Take a look at my code and pls tell me how to solve this. What i am trying to achieve is to have the

Contact

as a title and then phone and email to be each rendered once with their corresponding item.

Hope you understand what i mean :) Thanks!

1 Answer 1

1

You were initializing objects in contact array wrongly.

Here is how you should initialize:-

this.state = {
      contact: [{ phone: "000000", email: "[email protected]" }]
    };
Sign up to request clarification or add additional context in comments.

1 Comment

OMG Thank you! i don't know how i didn't think at this before. Facepalm :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.