DEV Community

Discussion on: Setting up a news letter with React and mailchimp

Collapse
cgobbet profile image
Cassiano Gobbet

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?

Collapse
raphaelpinel profile image
Raphaël Pinel

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

Collapse
tallangroberg profile image
Tallan Groberg Author

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