React .env

Seo·2020년 5월 9일
0

Front-End

목록 보기
10/21

React
CRA(Create-React-App)를 사용하는 경우, REACT_APP을 앞에 붙여서 환경변수를 만들수 있다.
(https://create-react-app.dev/docs/adding-custom-environment-variables/)
.env를 별도의 설치 없이 사용할 수 있다.

REACT_APP_URL=http://localhost:3001

위와 같이 REACT_APP을 앞에 붙인 후에 변수를 선언해주면 된다.
env파일을 수정하게되면 꼭 재부팅 해줘야한다.
나머지 부분은 기존의 dotenv와 비슷하다.

Reference

https://velog.io/@qksud14/oneroomtell-04

profile
개발관심자

0개의 댓글