Design comparison
Solution retrospective
Drag and Drop functionality works.. but I'm not sure why!
In App.js; 'completeTask' function; I understand why the commented version lines 46-56 didn't work (changing value but not the reference object itself), but then the other version lines 58-68 does work despite the only difference being used the value from the 'completeState' closure (line 59). I don't understand why the closure would make it work when it's only changing a value.
In ListToDo.js; 'dragTaskEnter' function; Why would setList() on line 19 work, but not the setList(() =>) on line 25? When I logged information both functions successfully updated the parent state in App.js (taskList), but the commented version would not receive updated props (the component rendered again, it just didn't receive the updated parent state). I don't understand why this should be so.
If a React whiz could shed some insight on these issues I'd be very grateful :)
Any and all feedback is greatly appreciated! Many thanks!
Community feedback
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord