I am using react-map-gl and I want to somewhat put a background color outside the polygon that was created. I tried using multiple <Layers />
but it looks like it does not accept multiple instances.
<Source id="polygons-source" type="geojson" data={geojsonData}>
<Layer
id="polygons"
type="line"
source="polygons-source"
paint={{
'line-color': 'red',
'line-opacity': 1,
'line-width': 1
}}
/>
<Layer
id="polygons"
type="fill"
source="polygons-source"
paint={{
'fill-color': 'transparent',
'fill-opacity': 0.5
}}
/>
<Layer
id="polygons"
type="background"
source="polygons-source"
paint={{
'background-color': 'gray',
'background-opacity': 0.5
}}
/>
</Source>
It just show me the first instance of the <Layer />
component