From 02376ac97fbdd794cc487dd6d1131fb8c925c890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Wed, 17 May 2023 22:18:32 -0600 Subject: Displayed correct index. Index was hard-coded. Now it retrieves current last index used. --- src/ToDo.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/ToDo.jsx') diff --git a/src/ToDo.jsx b/src/ToDo.jsx index 6ae8311..b3e091d 100644 --- a/src/ToDo.jsx +++ b/src/ToDo.jsx @@ -1,9 +1,14 @@ import React, { useState } from "react"; import { useSelector, useDispatch } from "react-redux"; -import { add_todo, select_todos } from "./features/todo/reducer"; +import { + add_todo, + select_todos, + select_last_index, +} from "./features/todo/reducer"; export function NewToDo() { const my_todos = useSelector(select_todos); + const my_last_idx = useSelector(select_last_index); const dispatch = useDispatch(); const [new_text, set_new_text] = useState(""); @@ -68,7 +73,7 @@ export function NewToDo() { -- cgit v1.2.3