π Public
Map with React & D3 using useRef hook
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 descriptionMap
MIT Licensed





![[Test]](/viz/d20b7564aaa040f6bee2de307e87dd4d/social-image.png?v=fd6a36df7134450f87fc211bfe566016)


Comments
Sign in to join the discussion.