boolean-uk / team-dev-frontend-client

1 stars 11 forks source link

Link CohortAddPopup to CohortList - to update list automatically #163

Closed lucianosimoni closed 1 year ago

lucianosimoni commented 1 year ago

The component CohortAddPopup (see issue #115) has been created, but component CohortList (see issue #113) is not updating the list of cohorts after the add is being done on the CohortAddPopup

What must be done

  1. CohortsList has a state called cohortsResponse. The cohorts is being render there. It must be updated by a function
  2. Create a function in CohortsList that gets the Cohorts from the DB (Same as the one inside useEffect()) and updates the cohortsResponse state.
  3. That function must be passed down to the component CohortAddPopup
  4. Inside CohortAddPopup: after the new data is posted to the DB, on the .then: call the new function passed down which will re-render the cohort list on CohortsList