Expected behavior
React new Activity component should be perfect to offload the map for lower priority rendering and preserving state. However it seems like the MapContainer implementation does not support it properly
https://react.dev/reference/react/Activity
Actual behavior
You get the following error in the console:
"Map container is being reused by another instance"
Steps to reproduce
Using the Activity component and toggle between hiding and viewing the map container:
<Activity mode={activeTab === 'map' ? 'visible' : 'hidden'}>
<MapContainer center={center} zoom={zoom}>
<TileLayer url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" />
</MapContainer>
</Activity>