Set up .env in react project tips
Dedar Alam
Posted on October 24, 2021
Found this tips while i'm fetching issue set up .env variable in react project
- The .env file should be in the root for you application folder. That is one level above your src folder, the same place where you have your package.json
- The variable should be prefixed with
REACT_APP_
You need to restart the server to reflect the changes in your code. - You should access the variable in your code like this
process.env.REACT_APP_SOME_VARIABLE
- No need to wrap your variable value in single or double quotes.
- Do not put semicolon
;
or comma,
at the end of each line.
๐ ๐ช ๐
๐ฉ
Dedar Alam
Posted on October 24, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
react Boost Your Productivity: React.js Is Magic: How It Changed the Game for Developers ๐ฉโจ
November 18, 2024