i am trying to display a map with ArcGis Js Api in ReactJS
import Map from "@arcgis/core/Map"; import WebMap from "@arcgis/core/WebMap"; import MapView from "@arcgis/core/MapView"; function Test() { const webmap = new WebMap({ portalItem: { id: "e691172598f04ea8881cd2a4adaa45ba" } }); /************************************************************ * Set the WebMap instance to the map property in a MapView. ************************************************************/ const view = new MapView({ map: webmap, container: "viewDiv" }); return( <div> <div id="viewDiv"></div> </div> ) }; export default Test;
but i get the error " Error: Can't resolve '@arcgis/core/MapView' "
i tried to fix the error with re-installing the module @arcgis/core, Webpack and others but i couldn't fix it
can someone help me please ?
@ShainaAlia - First install the ArcGIS library in the react app folder using
npm install @arcgis/core
Please follow the blog from @ReneRubalcava to get the step by step process create-react-app
Your path to MapView incorrect, you miss views directory. Try import MapView from "@arcgis/core/views/MapView"; like in official docs