Tallan, thanks for the tutorial. I created a separated component, but I still have a problem: the component does not find the URL on the .env file, it says it's undefined. Does .env must have only REACT_APP_MAILCHIMP_URL='Mailchimp_URL' and nothing else?
You need to put the .env file in the root folder, not in src and restart your server. Also the dotenv package is not needed anymore, it should work out of the box.
The .env file can contain multiple variables
So you can have more than one environment variable. A good way to trouble shoot this would be to see if you could console log the process.env. REACT_APP_MAILCHIMP_URL If you think other things in your .env could be causing problems, my suggestion would be to take out everything that wasn’t an env variable in the file. No commas or semi colons etc.
I hope this helps
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Tallan, thanks for the tutorial. I created a separated component, but I still have a problem: the component does not find the URL on the .env file, it says it's undefined. Does .env must have only REACT_APP_MAILCHIMP_URL='Mailchimp_URL' and nothing else?
You need to put the .env file in the root folder, not in src and restart your server. Also the dotenv package is not needed anymore, it should work out of the box.
The .env file can contain multiple variables
So you can have more than one environment variable. A good way to trouble shoot this would be to see if you could console log the process.env. REACT_APP_MAILCHIMP_URL If you think other things in your .env could be causing problems, my suggestion would be to take out everything that wasn’t an env variable in the file. No commas or semi colons etc.
I hope this helps