mirror of
https://github.com/DerTyp7/example-esri-react.git
synced 2025-10-30 13:07:09 +01:00
create first vanilla map test
This commit is contained in:
46
src/App.js
46
src/App.js
@@ -1,25 +1,31 @@
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import React, { useRef, useEffect } from "react";
|
||||
import "./App.css";
|
||||
import Map from "@arcgis/core/Map";
|
||||
import MapView from "@arcgis/core/views/MapView";
|
||||
import esriConfig from "@arcgis/core/config"; // https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html
|
||||
|
||||
//! Uncomment this for online api use
|
||||
/*esriConfig.apiKey =
|
||||
"//! FREE_API_KEYS_ARE_AVAIABLE_HERE: https://developers.arcgis.com/api-keys/";*/
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
const MapEl = useRef(null);
|
||||
useEffect(() => {
|
||||
const map = new Map({
|
||||
basemap: "topo-vector", //"arcgis-topographic" for online api use
|
||||
});
|
||||
|
||||
const view = new MapView({
|
||||
container: MapEl.current,
|
||||
map: map,
|
||||
});
|
||||
});
|
||||
return <div style={{ height: 800 }} ref={MapEl}></div>;
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
||||
/*
|
||||
https://developers.arcgis.com/javascript/latest/tooling-intro/
|
||||
https://developers.arcgis.com/javascript/latest/get-started/
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user