'React process.env variable is undefined (With Laravel)
I'm having a problem with loading data from the same .env file Laravel uses, here is the the key i have in the env.

Im trying to load it in a react component here:
However, when i log the same value in the console the value turns out the be undefined.

I've tried using the dotenv library, however this brings up issues with Webpack, and i couldn't figure out how to get it working.
Does anyone have an idea why the values could be undefined?
Solution 1:[1]
For laravel & React if I recall correctly your .env files have to contain both MIX and REACT_APP so in your .env file
MIX_REACT_APP_SPOTIFY_ACCESS_TOKEN=SPOTIFY_ACCESS_TOKEN
Also, don't forget to restart your app. .env loads every restart.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bas bas |
