react-simple-maps
react-simple-maps copied to clipboard
How to know when Map loads
I am using react-simple-maps in a react hook function, so I do not have ComponentDidMount. If I try and useEffect, the useEffect calls before the map loads, is there a state I can pass to useEffect as a dependency to show when map loads?
There should be a prop on <Geographies />
called onGeographyPathsLoaded
. That should do the trick for you.
<Geographies geography="" onGeographyPathsLoaded={() => { /* do something */ }}>
{...}
</Geographies>
Thanks for that @zimrick here is an example I made up demonstrating this feature which is not listed in docs. https://codesandbox.io/s/137mkv6l24
@zimrick onGeographyPathsLoaded
seems to be missing in the new version, can you confirm if it's there or not?
@alkshendra-SEQ I confirm that onGeographyPathsLoaded does not exist anymore in v1.0.0-beta.0.
But why ?