how to hide api key in react app

JavaScript
// .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
node_modules
public  
src 
.env     <---- Here
.gitignore  
LICENSE 
README.md   
package-lock.json   
package.json

Source

Also in JavaScript: