From 593ab2d7d4ef972594131b125d9320c618e54691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Oliva?= Date: Wed, 17 May 2023 21:26:50 -0600 Subject: Redux used to add ToDos WE MADE IT!! I don't know how, but it is functional. :'3 --- src/features/todo/ToDo.jsx | 233 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 src/features/todo/ToDo.jsx (limited to 'src/features/todo/ToDo.jsx') diff --git a/src/features/todo/ToDo.jsx b/src/features/todo/ToDo.jsx new file mode 100644 index 0000000..c956ba1 --- /dev/null +++ b/src/features/todo/ToDo.jsx @@ -0,0 +1,233 @@ +import React, { useState } from "react"; +import { useSelector, useDispatch } from "react-redux"; +import { add_todo, select_todos } from "./reducer"; + +export function Reducer() { + const my_todos = useSelector(select_todos); + const dispatch = useDispatch(); + const [new_text, set_new_text] = useState(""); + const [new_done, set_new_done] = useState(false); + const [new_priority, set_new_priority] = useState("Low"); + + function handle_exit_modal() { + // https://stackoverflow.com/questions/27826381/clearing-form-input-fields-in-bootstrap + $("form").get(0).reset(); // Reset form + + set_new_text(""); + set_new_done(false); + set_new_priority("Low"); + + console.log("CLEANED."); + } + + return ( + <> +
+ +
+ + +
+ + + + + + + + + + + + {my_todos.map((item) => ( + + + + + + + + ))} + +
#NamePriorityDue DateActions
+
+ +
+
{item.text}{item.priority}{item.due_date} +
+ + +
+
+
+ + ); +} -- cgit v1.2.3