Answer the question
In order to leave comments, you need to log in
Why doesn't dotenv read variables from .env?
Hello!)
I want to read environment variables in a react application from a .env
. For this I use the dotenv library .
I created using the create-react-app
app. The default structure. All I have added is the import dotenv
and in the application App
output to the console environment variables:
To the .env
following:
URL=vk.com
Answer the question
In order to leave comments, you need to log in
The dot-env module is server-side, you cannot use it on the client. At most, you can parse its values in JSON and throw it into the assembly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question