Ionic 6 with React - environment variable

Viewed 19

So I started to learn Ionic and got an issue with environment variables.

I created an env.local file inside the root folder, added REACT_APP_API:'...'. I did stop and restart the server but my console.log(process.env.REACT_APP_API) log undefined and not the text inside of it.

Am I using it wrong with Ionic?

Solution:

I changed it to REACT_APP_API=myurl and it solved my issue as @MarcoKlein said.

0 Answers
Related