complete 2.11
This commit is contained in:
parent
949fef7a08
commit
fee3e03818
5 changed files with 771 additions and 5 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import axios from "axios";
|
||||
|
||||
import PersonList from "./components/PersonList";
|
||||
|
||||
const SearchArea = ({ onChangeHandler }) => {
|
||||
|
|
@ -34,13 +36,18 @@ const AddPersonForm = ({
|
|||
};
|
||||
|
||||
const App = () => {
|
||||
const [persons, setPersons] = useState([
|
||||
{ name: "Arto Hellas", number: 123 },
|
||||
]);
|
||||
const [persons, setPersons] = useState([]);
|
||||
const [searchString, setSearchString] = useState("");
|
||||
const [newName, setNewName] = useState("");
|
||||
const [newNumber, setNewNumber] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
axios.get("http://localhost:3001/persons").then((response) => {
|
||||
console.log(response.data);
|
||||
setPersons(response.data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const handleOnSubmit = (event) => {
|
||||
event.preventDefault();
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue