Relative Content

Tag Archive for reactjsgoogle-mapsmapboxgeojsonreact-leaflet

How can I dynamically retrieve GeoJSON data based on a given country or state name?

I am developing a Next.js application where I display a map on the dashboard using the react-leaflet package. When the dashboard page loads, a GET API is called, returning an array of strings, which are either country names or state names based on the user’s role. For example, if the user role is ADMIN, the API returns an array of country names like [‘India’, ‘Australia’, ‘Singapore’, ‘United States’, ‘Germany’]. If the user role is AGENT, the API returns an array of state names like [‘New Delhi’, ‘Alabama’, ‘Sakha Republic’, ‘Hiroshima’].