Skip to content

Instantly share code, notes, and snippets.

@Kellswork
Created September 29, 2021 22:27
Show Gist options
  • Save Kellswork/c8299d351a55bffe16a2f18205451641 to your computer and use it in GitHub Desktop.
Save Kellswork/c8299d351a55bffe16a2f18205451641 to your computer and use it in GitHub Desktop.
Updated App.js file, imported ContactsList
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