Skip to main content
100%

Map with React & D3 using useRef hook

✓ Published0🌍 Public
AAnimesh Nautiyal
Last edited Nov 3, 2020
Created on Nov 3, 2020

A world map visualizes country-level metrics such as population, name length, and GDP, colored on a grayscale-to-red gradient. Clicking a country zooms the projection to focus on that selection. Built with React and D3 v5, the example uses `useRef` and a custom `useResizeObserver` hook to track container dimensions, `geoMercator().fitSize` for projection, `geoPath` for rendering, and `scaleLinear` for the color scale with transitions on attribute updates.

AI-generated description

Map

MIT Licensed

Similar vizzes