Todo List


React Event handling Public New

Easy 

15min


Write a TodoList component that expects an items prop, and a list of objects, each with text and done properties.

TodoList also accepts an onItemClick function prop, which should be called when a user clicks an item in the list, if the item is not marked as done. Otherwise, the onItemClick should not be called and the click event itself should not be propagated further. The function should be called with two parameters:

  • the item object from the items list.
  • the event.
HTML5, CSS3
   

Run OK, but 2 out of 2 test cases fail:

  •   Clicking on a not done item should trigger onItemClick: Wrong answer
  •   Clicking on a done item should not trigger onItemClick or a parent click: Wrong answer