Kepler.gl as a react component

Mike Fabrikant
1 min readNov 30, 2020
git clone https://github.com/keplergl/kepler.gl.git
cd kepler.gl/examples/demo/src/components
git clone https://github.com/keplergl/kepler.gl.git
mv kepler.gl/examples/demo-app demo-app2

In package.json:

  • remove devDependencies
  • Replace scripts with:
“scripts”: {
“start”: “react-scripts start”,
“build”: “react-scripts build”,
“predeploy”: “npm run build”,
“deploy”: “gh-pages -d build”,
“test”: “react-scripts test — env=jsdom”,
“eject”: “react-scripts eject”
},
In dependencies, set react-redux version "^5.0.7",

create public/index.html with contents from https://github.com/keplergl/kepler.gl/blob/master/examples/demo-app/index.html

create src/index.js, and set content to https://github.com/keplergl/kepler.gl/blob/master/examples/demo-app/src/main.js.

in index.js, replace import store line with

import store from ‘./components/demo-app2/src/store’;

In ./src/components/demo-app2/src/app.j, sust before first import statement in add: /* eslint-disable import/first */

npm install --save dotenv

Add .env to demo-app with:

REACT_APP_MAPBOX_ACCESS_TOKEN= <your mapbox token>

To src/components/demo-app2/src/constants/default-settings.js,

change: MapboxAccessToken to REACT_APP_MAPBOX_ACCESS_TOKEN

--

--