When reading the code here
|
const deleteGoal = (goalId) => { |
I had the impression the whole deletion logic was handled there.
Only a side effect (updating the local state) was done there.
Two issues:
- a minor one is the confusion between
delete and onDelete which is lost halfway through components
- unclear separation of concerns.
GoalItem happens to know a lot more than it probably should. It could be a simple UI component that accepts a delete function that is defined in the parent component Dashboard and that handles everything including the react state update
When reading the code here
Development-Planner-Group-2/client/src/pages/DashboardPage.jsx
Line 61 in ebe2202
I had the impression the whole deletion logic was handled there.
Only a side effect (updating the local state) was done there.
Two issues:
deleteandonDeletewhich is lost halfway through componentsGoalItemhappens to know a lot more than it probably should. It could be a simple UI component that accepts adeletefunction that is defined in the parent componentDashboardand that handles everything including the react state update