diff --git a/docs/4-advanced/04-react/_samples/todo-edit/src/App.tsx b/docs/4-advanced/04-react/_samples/todo-edit/src/App.tsx index 65bb2bda9..771b04a99 100644 --- a/docs/4-advanced/04-react/_samples/todo-edit/src/App.tsx +++ b/docs/4-advanced/04-react/_samples/todo-edit/src/App.tsx @@ -6,7 +6,7 @@ export default function App() { const [todos, setTodos] = useState([]); const [nextId, setNextId] = useState(1); const [newTodo, setNewTodo] = useState(""); - const [edittingTodo, setEdittingTodo] = useState({ id: -1, title: "" }); + const [editingTodo, setEditingTodo] = useState({ id: -1, title: "" }); const addTodo = () => { setTodos([...todos, { id: nextId, title: newTodo }]); @@ -35,14 +35,14 @@ export default function App() { }; const editTodo = (todo: Todo) => { - setEdittingTodo(todo); + setEditingTodo(todo); }; const fixTodo = () => { setTodos( - todos.map((todo) => (todo.id === edittingTodo.id ? edittingTodo : todo)), + todos.map((todo) => (todo.id === editingTodo.id ? editingTodo : todo)), ); - setEdittingTodo({ id: -1, title: "" }); + setEditingTodo({ id: -1, title: "" }); }; return ( @@ -50,12 +50,12 @@ export default function App() {
    {todos.map((todo, i) => (
  • - {edittingTodo.id === todo.id ? ( + {editingTodo.id === todo.id ? ( <> { - setEdittingTodo({ id: todo.id, title: e.target.value }); + setEditingTodo({ id: todo.id, title: e.target.value }); }} />