You can use either SWR[0] or React Query[1] hooks to write a query to fetch data for the first component and whenever you make a post request from the second component, you call the mutation function to revalidate the first component's data and replace it.