Ok so here is a snippet from the code, I tried to pull out anything that would detract from what I am attempting to accomplish.
The code itself:
const ProjectMap: React.FunctionComponent = () => {
const mapDiv = useRef<null | HTMLDivElement>(null);
const [mapView, setMapView] = useState<null | MapView>(null);
useEffect(() => {
if (mapDiv.current) {
const webMap = new WebMap({
portalItem: {
id: 'c63925bb216a4186980d5a7419a7e918',
},
});
const view = new MapView({
map: webMap,
container: mapDiv.current,
});
view.when(() => {
const lyr = webMap.layers.getItemAt(0);
console.log('layer from webmap:');
console.log(lyr);
lyr.allSublayers.find((sublayer) => sublayer.id === 0);
});
setMapView(view);
}
}, []);
return <div ref={mapDiv} className="mapDiv" />;
};
export default ProjectMap;
The errors that I am seeing related to the types are:
And the console output of the layer that I initially got from the web map is here (showing the loaded value and type of the item):
I really appreciate you helping with this, I watch all your youtube stuff its great!