Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to import dotenv in react

//create .env file and use prefix "REACT_APP_" infront of variable name
//for example
REACT_APP_TOKEN=abcdefghijklmnopqrstuvwxyz

// inside react file simple call it by
process.env.REACT_APP_TOKEN

//if your react server was running before creation of .env and restart it.
 
PREVIOUS NEXT
Tagged: #import #dotenv #react
ADD COMMENT
Topic
Name
4+5 =