All Projects → tomwayson → esri-react-router-example

tomwayson / esri-react-router-example

Licence: Apache-2.0 license
Example of how to load and use the ArcGIS API for JavaScript in a react-router application

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to esri-react-router-example

Webpack Core Usage
webpack2完整系列课程,欢迎阅读。同时欢迎移步我的react全家桶文章全集: https://github.com/liangklfangl/react-article-bucket
Stars: ✭ 94 (+291.67%)
Mutual labels:  react-router, lazy-loading
React Mobx React Router4 Boilerplate
React, React-Router 4, MobX and Webpack 2-boilerplate with async routes.
Stars: ✭ 566 (+2258.33%)
Mutual labels:  react-router, lazy-loading
sunrise
The rise of a new project with React, Redux-Saga and React-Router
Stars: ✭ 13 (-45.83%)
Mutual labels:  react-router
reactplate
[unmaintained] 🚀 A Minimal Setup & Fast Boilerplate for React.js with Vite.
Stars: ✭ 25 (+4.17%)
Mutual labels:  react-router
README-ecoleta
🎁 Três modelos de README com o Projeto criados para o blog da @Rocketseat 🚀
Stars: ✭ 179 (+645.83%)
Mutual labels:  react-router
react-authentication-in-depth
Example of User Authentication using React with React Router and AWS Amplify
Stars: ✭ 61 (+154.17%)
Mutual labels:  react-router
react-passage
Link and Redirect to routes safely in your react applications 🌄
Stars: ✭ 61 (+154.17%)
Mutual labels:  react-router
socialApp-MERN
Social Networking web app similar to Instagram.
Stars: ✭ 35 (+45.83%)
Mutual labels:  react-router
osprey-delight
Osprey Delight is the free-minded artist's choice for a clutter-free and blazingly fast single-page portfolio.
Stars: ✭ 43 (+79.17%)
Mutual labels:  lazy-loading
douban-movie-electron
This is electron app for douban movie
Stars: ✭ 19 (-20.83%)
Mutual labels:  react-router
react-express-mongodb
基于react全家桶+antd design+webpack2+node+express+mongodb开发的前后台博客系统
Stars: ✭ 26 (+8.33%)
Mutual labels:  react-router
typesafe-react-router
Utility functions to help facilitate type-safe routing with react-router
Stars: ✭ 90 (+275%)
Mutual labels:  react-router
material-ui-Link-within-MenuItem
Example for how to use `react-router/Link` within `material-ui/MenuItem`
Stars: ✭ 19 (-20.83%)
Mutual labels:  react-router
cra-flask
Unejected create-react-app ui, flask api with token authentication
Stars: ✭ 20 (-16.67%)
Mutual labels:  react-router
Client
TRPG即时IM通讯软件客户端,基于React 与 React Native + Redux技术
Stars: ✭ 118 (+391.67%)
Mutual labels:  react-router
laravel-react-boilerplate
Laravel React Boilerplate with Ant Design, Route-Level Code Splitting, Redux, Sanctum Auth
Stars: ✭ 49 (+104.17%)
Mutual labels:  react-router
react-spa-template
This is a sample template for single page applications built using React + Router to work with webpack dev server
Stars: ✭ 19 (-20.83%)
Mutual labels:  react-router
ember-cli-g-maps
Deprecated Google Maps Addon
Stars: ✭ 58 (+141.67%)
Mutual labels:  lazy-loading
react-ssr-starter
🔥 ⚛️ A React boilerplate for a universal web app with a highly scalable, offline-first foundation and our focus on performance and best practices.
Stars: ✭ 40 (+66.67%)
Mutual labels:  react-router
laravel-react-spa
A Laravel-React SPA starter project template.
Stars: ✭ 94 (+291.67%)
Mutual labels:  react-router

esri-react-router-example

This example application has been archived because it is very out of date. See https://github.com/tomwayson/create-arcgis-app/ for a more complete and modern implementation using recent versions of Create React App and React Router as well as ArcGIS REST JS.

Example of how to use esri-loader-react and esri-loader to load the ArcGIS API for JavaScript in a react-router application.

View it live

How it works

The ArcGIS API is not needed until the user navigates to the /map route, but we can preload the script without blocking rendering by including esri-loader-react's <EsriLoaderContainer /> component.

Once on the map route, the <Map> component loads the esri/arcgis/util module using esri-loader's dojoRequire() and then renders a map:

// modules/Map.js
componentDidMount () {
  // get item id from route params or use default
  const itemId = this.props.params.itemId || '8e42e164d4174da09f61fe0d3f206641'
  // require the map class
  dojoRequire(['esri/arcgis/utils'], (arcgisUtils) => {
    // create a map at a DOM node in this component
    arcgisUtils.createMap(itemId, this.refs.map)
    .then((response) => {
      // hide the loading indicator
      // and show the map title
      // NOTE: this will trigger a rerender
      this.setState({
        mapLoaded: true,
        item: response.itemInfo.item
      })
    }, (err) => {
      this.setState({
        mapLoaded: true,
        error: err.message || err
      })
    })
  })

Why?

See the esri-loader documentation for an explanation of why you would use these techniques.

Development instructions

First you'll need Node.js and the package manager that comes with it: npm.

git clone https://github.com/tomwayson/esri-react-router-example
cd esri-react-router-example
npm install
npm start

Now open up http://localhost:8080

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].