I recently updated from React 16 to React 18 and performance during rendering has decreased substantially. The issue appears to be that unmounting components is a slow process. I ran a performance analysis navigating away from the same page and I can see that when I am using React 18 the event handler on page transition takes almost 3 seconds versus 750ms for the same thing in React 16. I am also seeing this lagging behavior any time a component with many children (like a table) is removed from the DOM. Running the React Profiler shows "react commit" is taking up most of the time. Is there some way to make improve React 18 performance when removing components from the screen? Has anyone else noticed this behavior?
I included screenshots of the performance analysis from clicking on a link to navigate away from a page with a table.