Skip to content

Esri/react-redux-js4

Repository files navigation

ArcGIS JS API 4.4 / React / Redux Boilerplate

Web Scene viewer boilerplate web application using React and Redux, including the ArcGIS JS API as middleware. This boilerplate example integrates:

It provides two useful Redux middleware examples:

  • arcgis-authentication to handle Portal login
  • arcgis-sceneview to show a SceneView with a WebScene, handle selection, and environment changes.

The example application displays a web scene with a simple sun position slider.

Cover image

Instructions

Installing

Download the repository and install the dependencies:

$ npm install

Registering your App

For this code to work, you need to add and register an app in ArcGIS Online, add the correct redirect URI (e.g. http://localhost:8080), and add the App ID to /src/constants/app-constants.js.

Finally, update /src/constants/app-constants.js to contain your App ID (and portal URL if not ArcGIS Online):

export const APP_ID = '<insert App ID here>';
export const APP_PORTAL_URL = 'https://www.arcgis.com';

Note that you need at least one web scene in your account for the app to work correctly.

Running

Run tests:

$ npm test

Run ESLint:

$ npm run lint

Build and run live server:

$ npm run server

Development Workflow

The ArcGIS JS API is based on Dojo. To make this ES6 application work, we use Babel to transpile and Webpack to bundle it into an AMD module. This AMD module is configured as the application (app) in dojoConfig.js.

This package uses Gulp for workflow automation.

Redux Dev Tools

This package supports the Redux DevTools Extension for Chrome. You can browse the state and dispatch actions live while the application is running.

Redux Dev Tools

Hot Module Replacement

This example supports Hot Module Replacement. Updated components or reducers are automatically replaced while the application is running. The state is preserved during updates, and the web scene does not need to be reloaded.

Hot Module Replacement

Tests

This example includes Jest tests for:

  • Action creators
  • Reducers
  • ArcGIS Middleware

And Enzyme tests for:

  • Components

For more details on testing see Writing Tests - Redux.

About

Boilerplate ArcGIS JS API 4.x app using React and Redux

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published