MCPcopy Create free account
hub / github.com/codemistic/Web-Development / App

Function App

Google Keep Clone/src/components/App.jsx:7–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import CreateArea from "./CreateArea";
6
7function App() {
8 const [notes, setNotes] = useState([]);
9
10 function addNote(newNote) {
11 setNotes(prevNotes => {
12 return [...prevNotes, newNote];
13 });
14 }
15
16 function deleteNote(id) {
17 setNotes(prevNotes => {
18 return prevNotes.filter((noteItem, index) => {
19 return index !== id;
20 });
21 });
22 }
23
24 return (
25 <div>
26 <Header />
27 <CreateArea onAdd={addNote} />
28 {notes.map((noteItem, index) => {
29 return (
30 <Note
31 key={index}
32 id={index}
33 title={noteItem.title}
34 content={noteItem.content}
35 onDelete={deleteNote}
36 />
37 );
38 })}
39 <Footer />
40 </div>
41 );
42}
43
44export default App;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected