- Replace
<your_account>
with your Github username in the DEMO LINK - Follow the React task guideline
Implement simple TODO app working as described below.
If you are not sure about how a feature should work just open the real TodoApp and look how it works there
- Implement
TodoApp
component with an input field to create new todos on submit (Enter). Each item should have:id
- unique identifier (+new Date()
is good enough)title
- the text of a todocompleted
- current status (false
by default)
- Show the number of not completed todos in
TodoApp
- Implement
TodoList
component to display a list of todos<TodoList items={todos} />
- Implement
TodoItem
component with ability to toggle thecompleted
status.- move the
li
tag inside theTodoItem
- add class
completed
if todo is completed
- move the
- Add ability to toggle the completed status of all the todos.
toggleAll
checkbox is active only if all the todos are completed- if you click the checkbox all the items should be marked as
comlpeted
/not completed
depending ontoggleAll
status
- Create
TodosFilter
component to switch betweenall
/active
/completed
todos (add it to theApp
)- Use constants instead of just strings (for example
FILTERS.all
)
- Use constants instead of just strings (for example
- Add ability to remove an item.
- Add ability to
clear completed
- remove all completed items from the list.- It should be visible if there is at least 1 completed item in the list.
- Hide everything except the input to add new todo if there are no todos. But not if todos are just filtered out.
- Make inline editing for the TODO item
- double click on the TODO title makes it editable (just add a class
editing
to ali
) - DON'T add
htmlFor
to the label!!! Enter
saves changesEcs
cancels editing- Todo title can't be empty!
- (*) save changes
onBlur
- double click on the TODO title makes it editable (just add a class
- Save state of the APP to the
localStorage
(Required theory)- use
JSON.stringify
before saving andJSON.parse
on reading
- use
Implement saving the todos in the API.
BEFORE you started:
- Create a user by sending a POST request to the
/users
. - Save the
userId
in your code and use it for all the future request where it is required
Tasks
- Load a user from
/users/:userId
and show your name on the page - Load all the todos from
/todos
and filter them byuserId
to show only your todos in the App - Save new todos by sending POST request to
/todos
(don't forget to adduserId
)- use
JSON.stringify
when sending abody
- Think what to do in case of a server error (at least notify the user)
- use
- Delete the todo by sending DELETE to
/todos/:todoId
- Toggle completed status or rename the todo by sending
PATCH
to the/todos/:todoId
- you can send only changed fields (
completed
oftitle
)
- you can send only changed fields (
- Implement
toggleAll
functionality (try to send as few requests as possible) - Implement
clear completed
sending as few requests as possible