From fdf0bc41f605e4d02049e25cccb412d4efac8988 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 19 Jul 2026 15:08:05 +0200 Subject: [PATCH] Baustein abgeschlossen --- leuchtturm-react/src/App.jsx | 1 + react-todolist/src/App.jsx | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/leuchtturm-react/src/App.jsx b/leuchtturm-react/src/App.jsx index 968dbff..be74721 100644 --- a/leuchtturm-react/src/App.jsx +++ b/leuchtturm-react/src/App.jsx @@ -36,6 +36,7 @@ function App() { element={ } /> diff --git a/react-todolist/src/App.jsx b/react-todolist/src/App.jsx index 9cf119e..754b89d 100644 --- a/react-todolist/src/App.jsx +++ b/react-todolist/src/App.jsx @@ -2,11 +2,18 @@ import {useState, useEffect} from "react"; const STORAGE_STRING = 'todo-app-todos'; +let i = 0; + export default function App() { const [input, setInput] = useState(""); const [todos, setTodos] = useState(JSON.parse(localStorage.getItem(STORAGE_STRING))||[]); - useEffect(() => persistTodos(),[todos]); + useEffect(() => { + persistTodos(); + console.log("test"); + },[todos]); + + useEffect(() => console.log(i++), []); function persistTodos() { localStorage.setItem(STORAGE_STRING, JSON.stringify(todos));