react-simple-maps icon indicating copy to clipboard operation
react-simple-maps copied to clipboard

How to know when Map loads

Open the133448 opened this issue 5 years ago • 4 comments

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?

the133448 avatar May 17 '19 06:05 the133448

There should be a prop on <Geographies /> called onGeographyPathsLoaded . That should do the trick for you.

<Geographies geography="" onGeographyPathsLoaded={() => { /* do something */ }}>
  {...}
</Geographies>

zimrick avatar May 17 '19 08:05 zimrick

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

the133448 avatar May 18 '19 00:05 the133448

@zimrick onGeographyPathsLoaded seems to be missing in the new version, can you confirm if it's there or not?

alkshendra-SEQ avatar Nov 11 '19 09:11 alkshendra-SEQ

@alkshendra-SEQ I confirm that onGeographyPathsLoaded does not exist anymore in v1.0.0-beta.0.

But why ?

edouarobin avatar Jan 10 '20 00:01 edouarobin