Answers for "how to import dotenv in react"

4

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.
Posted by: Guest on December-17-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language