import { useState } from "react"; import Note from "./components/Note"; const App = ({ startingNotes }) => { const [notes, setNotes] = useState(startingNotes); const [newNote, setNewNote] = useState("a new note..."); const [showAll, setShowAll] = useState(true); const addNote = (event) => { event.preventDefault(); const newNoteObject = { content: newNote, important: Math.random() < 0.5, id: String(notes.length + 1), }; setNotes(notes.concat(newNoteObject)); setNewNote(""); }; const handleNoteChange = (event) => { console.log(event.target.value); setNewNote(event.target.value); }; const notesToShow = showAll ? notes : notes.filter((note) => note.important === true); return (

Notes

{" "} {" "}
); }; export default App;