This is my first time using the ArcGIS API for JavaScript. I'm running into a fairly elementary error. I cannot get a layer I have hosted on ArcGIS Online to appear on the map. Here is my code:
require([
"esri/config",
"esri/Map",
"esri/layers/FeatureLayer",
"esri/views/MapView"
], function (esriConfig, Map, MapView, FeatureLayer) {
//Setting the API key
esriConfig.apiKey = api key hidden
const map = new Map({
basemap: "arcgis-topographic"
});
const view = new MapView({
container: "viewDiv",
map: map,
extent: {
xmin: -88.4407865369763,
ymin: 44.2519512604157,
xmax: -87.57033074655209,
ymax: 44.58559644055305,
spatialReference: 4326
},
});
let one_year_high = new FeatureLayer({
id: "1-year-high",
apiKey: api key hidden
});
map.add(one_year_high);
});
This script produces the following error in my browser:
[esri.Map] #add() The item being added is not a Layer or a Promise that resolves to a Layer.
My layer can be found here: https://services.arcgis.com/HRPe58bUyBqyyiCt/ArcGIS/rest/services/1_year_high_lake_level/FeatureServer/13
I can't figure out why it won't appear.
Thanks in advance.