Mapchart with tooltip
This example shows how to create a world map with tooltips using react-tooltip. The tooltip displays the name of the country and the population.
Caveats
Note that you have to use React.memo
in order to prevent excessive rerendering when the content of the tooltip is set. Unfortunately it is not possible to set data-tip
on a geography directly, therefore you have to set it on ComposableMap
.
Custom geographies
If you want to use your own shapefiles with react-simple-maps check out this tutorial on how to convert shapefiles to topojson using mapshaper.org.