File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -27,12 +27,19 @@ function App() {
2727 setTodos ( ( todos ) => [ ...todos , newTodo ] ) ;
2828 } ;
2929
30+ const deleteTodo = ( deleteTodoRowNumber ) => {
31+ let filtered = todos . filter ( function ( value ) {
32+ return value . rowNumber !== deleteTodoRowNumber ;
33+ } ) ;
34+ setTodos ( filtered ) ;
35+ } ;
36+
3037 return (
3138 < div className = "mt-5 container" >
3239 < div className = "card" >
3340 < div className = "card-header" > Your Todo's</ div >
3441 < div className = "card-body" >
35- < TodoTable todos = { todos } />
42+ < TodoTable todos = { todos } deleteTodo = { deleteTodo } />
3643 < NewTodoForm addTodo = { addTodo } />
3744 </ div >
3845 </ div >
Original file line number Diff line number Diff line change 11export default function TodoRowItem ( props ) {
22 return (
3- < tr >
3+ < tr onClick = { ( ) => props . deleteTodo ( props . rowNumber ) } >
44 < th scope = "row" > { props . rowNumber } </ th >
55 < td > { props . rowDescription } </ td >
66 < td > { props . rowAssigned } </ td >
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export default function TodoTable(props) {
1717 rowNumber = { todo . rowNumber }
1818 rowDescription = { todo . rowDescription }
1919 rowAssigned = { todo . rowAssigned }
20+ deleteTodo = { props . deleteTodo }
2021 />
2122 ) ) }
2223 </ tbody >
You can’t perform that action at this time.
0 commit comments