🌍 Public
Viewing a saved revision (read-only)
d7c0828fd8df4678bbb50958b764f04c
Making map in react d3 method 1
This example demonstrates how to render a choropleth map of Indian states and districts using React and D3 v6. The application loads TopoJSON data from two external GitHub gists, converts it to GeoJSON features, and displays the map as an SVG path using D3’s geoMercator projection and geoPath generator. The map fills each state polygon with a teal color and updates when new geometry is fetched. The code uses React hooks (useRef, useEffect, useState) to manage the SVG selection and state data, with d3.json loading the TopoJSON and topojson.feature converting the topology.
AI-generated descriptionMaking map in react d3 method 1