As per the create-react-app documentation, unless you're creating toy apps, it's not a good idea to store secret keys in your React app.
But, in case you really need to:
If you're using create-react-app, there's no need to install a separate dotenv library, as it's supported out of the box.
Otherwise, dotenv-webpack
is probably something you can try. See this other SO question.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…