Big Todo app React
Yo!
I have changed the TodoContext now to only have the List as states while the functions are in the separate pages.
However, I am having huge trouble with your other tip:
When I try to Edit a Todo Item, you told me to use the map function, to map over the todo and apply the necessary changes.
While I managed to do exactly this (code is in EditTask.jsx, line 102 onward the commented-out one), it only works when I have 1 todo.
As soon as I have 2 todos and I try to change one of the todos, it crashes because the other todo becomes undefined.
I currently have another solution that works fine for me, but it looks pretty bad, to be honest:
I tried pretty much stuff and my brain just doesn't work at this point anymore lol. I think I understand that I have to set state that the Tasklist still has both tasks, while only the edited task gets changed and applied. So I tried to set state like:
setTaskList([...taskList, newTaskList]), but this basically doubles my tasklist all the time when I edit a todo.
I think I am close, but I just need something to get pushed over the edge...
8
4 comments
Heinrich Berg
3
Big Todo app React
Developer Pro
skool.com/developerpro
Learn how to code. Make money. Have fun. Enjoy life.
Leaderboard (30-day)
Powered by