react weather app how to secure api key code example
Example 1: how to hide api key in react app
// .env
API_KEY=your_api_key <-- this won't work
REACT_APP_API_KEY=your_api_key <-- yes! this work
// Example:
// REACT_APP_GOOGLE_API_KEY=123456
Example 2: how to hide api key in react app
node_modules
public
src
.env <---- Here
.gitignore
LICENSE
README.md
package-lock.json
package.json