-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react1-week3/Viki #289
base: main
Are you sure you want to change the base?
react1-week3/Viki #289
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@VictoriaDem17 Heey, The app is beautiful as always 👏 Great job! I have found some issues related to functionality, please look into it. Thank you!
@@ -0,0 +1,81 @@ | |||
import { v4 as uuidv4 } from "uuid"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kudos for using uuid
library 👏
import TodoList from "./components/TodoList"; | ||
import Form from "./components/Form"; | ||
import Header from "./components/Header"; | ||
import Timer from "./components/Timer"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @VictoriaDem17, The app is crashing right now due to a mismatch between file names for Form, TodoList, and Header.
Please fix the file names :) (All of them should be capitalized)
|
||
const TodoList = ({ todos, setTodos, setEditTodo }) => { | ||
const handleComplete = ({ id }) => { | ||
setTodos( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although it's not wrong but its better to use the parameter from setter
directly, to ensure the data stay consists
The same applies for all methods :)
setTodos(prevTodos => prevTodos.map ... )
"https://gist.githubusercontent.com/benna100/391eee7a119b50bd2c5960ab51622532/raw" | ||
) | ||
.then((res) => res.json()) | ||
.then((data) => setTodos(data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing error handling
|
||
return ( | ||
<div> | ||
{todos.length === 0 ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is ok, but I think you can choose more readable approach
if(todos.length === 0) return null
return (
<div> {todos.map... }..... </div>)
|
||
useEffect(() => { | ||
if (editTodo) { | ||
setInput(editTodo.description, editTodo.deadline); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this wont work, setter takes only one argument, you are passing to
editTodo, | ||
setEditTodo, | ||
}) => { | ||
const updateTodo = (description, id, completed, deadline) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The update logic is broken right now, please look into it
Screen.Recording.2024-04-14.at.15.12.17.mov
/> | ||
<input | ||
type="date" | ||
className="deadline-input" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can set minValue for date to prevent selecting the dates in the past
No description provided.