ENV
-
[REACT] .env 환경설정 파일 사용하기React 2022. 7. 21. 14:12
.env 파일은 중요한 설정파일이나 Key 값같은 보안이 필요한 부분을 "키=값"의 형태로 환경설정파일에시 보관하고 관리하기 위한 파일이다. 아래와 같은 형태로 설정값저장. *여기서 중요한사실은 변수들은 반드시 REACT_APP_ 로 시작해야 인식을 한다는 점이다. (이거 찾느라 엄청나게 삽질함.^^) js 파일에서 사용할때는 아래처럼 사용하면 됩니다. 그리고, github를 사용한다면 .gitignore 파일에 아래처럼 추가해서 버전관리에서 빠지게 해야겠죠. 이상입니다.