I need to implement a reCAPTCHA system in my React application. So, I registered the development and production domains with Google reCAPTCHA. I created two .env files, one .env.development.local and one .env.production.local in which I added the keys received during configuration. Please help me because it is not very clear to me what exactly needs to be done next. As far as I understand, I have to install the dotenv library, but further I don't know how to make the application use the keys depending on the environment in which it runs.
Is this ok?
index.js
import dotenv from 'dotenv';
dotenv.config();
export const RECAPTCHA_SITE_KEY =
process.env.NODE_ENV === 'development'
? process.env.REACT_APP_RECAPTCHA_KEY_DEV
: process.env.REACT_APP_RECAPTCHA_KEY_PROD;
Do I have to add something in package.json?
Thanks!