1

I am new to React and have used an example to put together a map to show data using Kepler. I am using a default token in my .env.local file. I created that file under my project folder using new file and giving it a name and then I only have the following line in it.

REACT_APP_MAPBOX_API = pk.someletters.hello 

// Keep in mind this token is the default token that I got when I created my account with mapbox. Is it ok to use the default token?

The way I am using it in my app.js iss

  <KeplerGl
    id="Test"

    mapboxApiAccessToken={process.env.REACT_APP_MAPBOX_API}
    width={window.innerWidth}
    height={window.innerHeight}
    />

The page renders but with this error. Its clearly not getting the mapbox identifier from the .env.local file.

index.js:1 Warning: Failed prop type: The prop `mapboxApiAccessToken` is marked as required in `MapContainer`, but its value is `undefined`. 

What am I not doing correctly here?

Also there is a warning coming that says

kepler-gl.js:179 Mapbox Token not valid. [Click here](https://github.com/keplergl/kepler.gl#mapboxapiaccesstoken-string-required)

When I click on that it just takes me back creating an account with mapbox and accessing token. Do I need to make a token with any consideration? or default is good.

Anyone?

neves
  • 33,186
  • 27
  • 159
  • 192
Sarah
  • 1,199
  • 2
  • 21
  • 42
  • Are you using a package like dotenv to loads environment variables from a .env file into process.env? – lezan Jun 29 '20 at 15:03

0 Answers0