1. 13
    Extract Environment Variable for the API Key
    32s

Extract Environment Variable for the API Key

Share this video with your friends

Send Tweet

While our API key is exposed when our page loads the map, we can configure our API keys to have 1 for development that no one can ever see and one for production where we would restrict the URL to our app.

To do this, we can use Create React Apps's built-in environment variable solution. You should be able to find an .env.shared.sample file that you can duplicate and remove sample from the name. You can then use this to fill in your details for the variables.

Click here for exercise instructions