Created
September 29, 2021 22:27
-
-
Save Kellswork/c8299d351a55bffe16a2f18205451641 to your computer and use it in GitHub Desktop.
Updated App.js file, imported ContactsList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react"; | |
import ContactForm from "./components/ContactForm.jsx"; | |
import ContactList from "./components/ContactList.jsx"; | |
import "./App.css"; | |
function App() { | |
// here we create an array state to store the contact form data | |
const [contacts, updateContacts] = useState([]); | |
const addContact = (contact) => { | |
updateContacts([...contacts, contact]); | |
}; | |
console.log(contacts) | |
return ( | |
<div className="App"> | |
<ContactForm addContact={addContact} /> | |
<ContactList contacts={contacts} /> | |
</div> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment