I'm building a map with react-leaflet and in the first load sometimes most of the tiles aren't visualized as you can see below:

I've gone through several stack overflow question and what I've done is:
- Include the leaflet CSS and JS in the
index.htmlfile - Include the leaflet CSS directly in the component file
- A
useEffectthat runs on every render and calls the methodmap.invalidateSize()taken by theuseMap()hook - A
useEffectthat runs on first render and calls the methodmap.invalidateSize()taken by theuseMap()hook - Use the
useMapEvents()hook and when the maps load run themap.invalidateSize()method taken by theuseMap()hook
Whenever I resize the browser window Leaflet renders all the tiles correctly 
Has someone encountered the same problem? How have you solved it?