<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: The ArcGIS API failed to load in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/the-arcgis-api-failed-to-load/m-p/1166390#M77072</link>
    <description>&lt;P&gt;Hi&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/570051"&gt;@mursalahmed&lt;/a&gt; if you are starting a new project with React and using local builds, then we recommend using our ES modules (@arcgis/core) instead of the AMD modules that are injected using the esri-loader library. Here is an example repository: &lt;A href="https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app" target="_blank"&gt;https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;You can learn more about the differences between the modules here: &lt;A href="https://developers.arcgis.com/javascript/latest/tooling-intro/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/tooling-intro/&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Apr 2022 20:30:16 GMT</pubDate>
    <dc:creator>AndyGup</dc:creator>
    <dc:date>2022-04-20T20:30:16Z</dc:date>
    <item>
      <title>The ArcGIS API failed to load</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/the-arcgis-api-failed-to-load/m-p/1166357#M77070</link>
      <description>&lt;P&gt;I have downloaded the&amp;nbsp;npm i --save esri-loader @esri/react-arcgis&amp;nbsp;but why is it i cant load the map? did i miss something?&lt;/P&gt;&lt;PRE&gt;import React from 'react';
import Map from '../../component/Map/Map.js'
const HomePage = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;Map/&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default HomePage;&lt;/PRE&gt;&lt;P&gt;component/Map/Map.js&lt;/P&gt;&lt;PRE&gt;import React , {useRef,useEffect} from 'react';
import {loadModules} from "esri-loader";


function Map() {
    const MapElement=useRef(null)
    useEffect(()=&amp;gt;{
        let view;

    loadModules(["esri/views/MapView", "esri/WebMap"],{
        css:true
    }).then(([MapView, WebMap])=&amp;gt;{
        const webmap= new WebMap({
            basemap:'topo-vector'
        })
        view = new MapView({
            map:webmap,
            center:[],
            zoom:8,
            container:MapElement.current
        })
    })
    return()=&amp;gt;{
        if(!!view){
            view.destroy()
            view=null
        }
    }
    })
    return (
        &amp;lt;div style={{height:800}} ref={MapElement}&amp;gt;
            
        &amp;lt;/div&amp;gt;
    )
}

export default Map&lt;/PRE&gt;&lt;P&gt;the error i get&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Huq7F.png" style="width: 991px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/39482iCEF9E8B1823F06D5/image-size/large?v=v2&amp;amp;px=999" role="button" title="Huq7F.png" alt="Huq7F.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the reference i used for this&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=0RC1Xf_0UUk" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.youtube.com/watch?v=0RC1Xf_0&lt;/A&gt;&lt;A href="https://deepmaterialvn.com/" target="_self"&gt;UK&lt;/A&gt;&lt;/P&gt;&lt;P&gt;package.json&lt;/P&gt;&lt;PRE&gt;{
       "name": "@country/app",   "private": true,   "scripts": {
       "start": "webpack serve",
       "start:standalone": "webpack serve --port 9003 --env standalone",
       "build": "concurrently yarn:build:*",
       "build:webpack": "webpack --mode=production",
       "analyze": "webpack --mode=production --env analyze",
       "lint": "eslint src --ext js",
       "format": "prettier --write .",
       "check-format": "prettier --check .",
       "test": "cross-env BABEL_ENV=test jest",
       "watch-tests": "cross-env BABEL_ENV=test jest --watch",
       "prepare": "husky install",
       "coverage": "cross-env BABEL_ENV=test jest --coverage"   },   "devDependencies": {
       "@arcgis/webpack-plugin": "^4.20.0",
       "@babel/core": "^7.15.0",
       "@babel/eslint-parser": "^7.15.0",
       "@babel/plugin-transform-runtime": "^7.15.0",
       "@babel/preset-env": "^7.15.0",
       "@babel/preset-react": "^7.14.5",
       "@babel/runtime": "^7.15.3",
       "@testing-library/jest-dom": "^5.14.1",
       "@testing-library/react": "^12.0.0",
       "babel-jest": "^27.0.6",
       "concurrently": "^6.2.1",
       "cross-env": "^7.0.3",
       "eslint": "^7.32.0",
       "eslint-config-prettier": "^8.3.0",
       "eslint-config-react-important-stuff": "^3.0.0",
       "eslint-plugin-prettier": "^3.4.1",
       "husky": "^7.0.4",
       "identity-obj-proxy": "^3.0.0",
       "jest": "^27.4.3",
       "jest-cli": "^27.4.3",
       "prettier": "^2.3.2",
       "pretty-quick": "^3.1.1",
       "webpack": "^5.51.1",
       "webpack-cli": "^4.8.0",
       "webpack-config-single-spa-react": "^4.0.0",
       "webpack-dev-server": "^4.0.0",
       "webpack-merge": "^5.8.0"   },   "dependencies": {
       "@esri/react-arcgis": "^5.1.0",
       "@material-ui/styles": "^4.11.4",
       "@mui/styles": "^5.2.2",
       "@reach/router": "^1.3.4",
       "arcgis-js-api": "^4.21.2",
       "esri-loader": "^3.3.0",
       "react": "^17.0.2",
       "react-dom": "^17.0.2",
       "single-spa-react": "^4.3.1"   }, }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 08:27:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/the-arcgis-api-failed-to-load/m-p/1166357#M77070</guid>
      <dc:creator>mursalahmed</dc:creator>
      <dc:date>2022-04-26T08:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: The ArcGIS API failed to load</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/the-arcgis-api-failed-to-load/m-p/1166390#M77072</link>
      <description>&lt;P&gt;Hi&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/570051"&gt;@mursalahmed&lt;/a&gt; if you are starting a new project with React and using local builds, then we recommend using our ES modules (@arcgis/core) instead of the AMD modules that are injected using the esri-loader library. Here is an example repository: &lt;A href="https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app" target="_blank"&gt;https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-create-react-app&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;You can learn more about the differences between the modules here: &lt;A href="https://developers.arcgis.com/javascript/latest/tooling-intro/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/tooling-intro/&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Apr 2022 20:30:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/the-arcgis-api-failed-to-load/m-p/1166390#M77072</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2022-04-20T20:30:16Z</dc:date>
    </item>
  </channel>
</rss>

