Contact List

This example displays a simple contact list.

jsxCopy codeimport React from 'react';
import ReactDOM from 'react-dom';

const contacts = [
  { name: 'Alice', phone: '123-456-7890' },
  { name: 'Bob', phone: '234-567-8901' },
  { name: 'Charlie', phone: '345-678-9012' },
];

function ContactList() {
  return (
<div>
  <h1>Contact List</h1>
  <ul>
    {contacts.map((contact, index) => (
      <li key={index}>
        {contact.name} - {contact.phone}
      </li>
    ))}
  </ul>
</div>
); } ReactDOM.render(<ContactList />, document.getElementById('root'));

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *