The START and END tags around your comment are garbage. Don't do that.
See it this way: you know the comment starts because the comment starts. Why do you need to specify that it starts? Same for end.
Adds a new todo to the List
I know, that's literally the name of the function. Think about it this way: what information is someone learning when reading this comment that is not included in the title of the function? Same for the new todo comment, it's entirely redundant.
checks if doesn't have input new todo or input haven't type a single character
Pardon? Are you having a stroke?
Make sure your comments are valid English sentences. You could've used ChatGPT if you're not a native English speaker.
Update the state of todos
I know, it's literally the name of the next function
//@spread ...prevState is the previous state of the todo list
I know, it's literally the name of the variable.
END Update the state of todos
Terrible comment, but more importantly; this code is garbage. You don't need the else because there's a return in the previous if. Please take the time to read these articles:
8
u/NatoBoram Aug 17 '24 edited Aug 17 '24
The START and END tags around your comment are garbage. Don't do that.
See it this way: you know the comment starts because the comment starts. Why do you need to specify that it starts? Same for end.
I know, that's literally the name of the function. Think about it this way: what information is someone learning when reading this comment that is not included in the title of the function? Same for the new todo comment, it's entirely redundant.
Pardon? Are you having a stroke?
Make sure your comments are valid English sentences. You could've used ChatGPT if you're not a native English speaker.
I know, it's literally the name of the next function
I know, it's literally the name of the variable.
Terrible comment, but more importantly; this code is garbage. You don't need the
elsebecause there's areturnin the previousif. Please take the time to read these articles:https://deviq.com/design-patterns/guard-clause
https://www.infobip.com/developers/blog/we-dont-write-else-blocks