Hi,
I'm migrating our react application from @ArcGIS/core to @ArcGIS/map-components-react and got most of it working. But I can't seem to figure out how to add a feature layer using these new components. I used to invoke the map.add() function but I no longer have a reference to a map object and don't see a component which represents what I need.
Is there some documentation on the subject that I'm missing or someone can point me to.
Thanks, John
The map and scene components have methods to add layers, addLayer and add layers.
So you can create a layer like you normally would and add it to the component.
Here's a sample adding a graphics layer and using sketch
Thanks @ReneRubalcava your refs pointed me in the right direction. For those wondering how to make it work with the @arcgis/map-components-react package this is what I came up with:
<ArcgisMap
itemId={process.env.NX_ArcGISPortalItem}
basemap="topo-vector"
spatialReference={SpatialReference.WebMercator}
zoom={buildZoom({centerLoc, zoom})}
center={centerPoint}
onArcgisViewReadyChange={event => setMapRef(event.target.map)} // This is the magic where we get a ref to the map which makes everything possible again :)
onArcgisViewClick={onArcGISViewClick}
>