From 1aa3b2b90ec98203becb5c4600e1e46b2d8fefa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Wed, 17 May 2023 21:36:24 -0600 Subject: Broken big function into smaller functions. --- src/ToDo-UI/ToDo.jsx | 116 +++++++++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 55 deletions(-) (limited to 'src/ToDo-UI') diff --git a/src/ToDo-UI/ToDo.jsx b/src/ToDo-UI/ToDo.jsx index 51e0c97..ceaed49 100644 --- a/src/ToDo-UI/ToDo.jsx +++ b/src/ToDo-UI/ToDo.jsx @@ -2,8 +2,9 @@ import React, { useState } from "react"; import { useSelector, useDispatch } from "react-redux"; import { add_todo, select_todos } from "../features/todo/reducer"; -export function Reducer() { +export function NewToDo() { const my_todos = useSelector(select_todos); + const dispatch = useDispatch(); const [new_text, set_new_text] = useState(""); const [new_done, set_new_done] = useState(false); @@ -16,8 +17,6 @@ export function Reducer() { set_new_text(""); set_new_done(false); set_new_priority("Low"); - - console.log("CLEANED."); } return ( @@ -176,58 +175,65 @@ export function Reducer() { -
- - - - - - - - - - - - {my_todos.map((item) => ( - - - - - - - - ))} - -
#NamePriorityDue DateActions
-
- -
-
{item.text}{item.priority}{item.due_date} -
- - -
-
-
); } + +export function ListToDos() { + const my_todos = useSelector(select_todos); + + return ( +
+ + + + + + + + + + + + {my_todos.map((item) => ( + + + + + + + + ))} + +
#NamePriorityDue DateActions
+
+ +
+
{item.text}{item.priority}{item.due_date} +
+ + +
+
+
+ ); +} -- cgit v1.2.3