Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

using .env in CRA

Dotenv is somehow already integrated in your CRA

Just create a .env in root
Inside your .env file don't forget to write "REACT_APP_" before your Variable name
i.e: replace ANYTHING_YOU_WANT = ABcdEfghI45545785 by REACT_APP_ANYTHING_YOU_WANT = ABcdEfghI45545785

In whatever file you want you can refere to your .env with 
`${process.env.REACT_APP_ANYTHING_YOU_WANT}`
 
PREVIOUS NEXT
Tagged: #CRA
ADD COMMENT
Topic
Name
6+1 =