'why my react native dotenv is not working?
I want to use react-native-dotenv but its not working.
https://github.com/zetachang/react-native-dotenv
I created a .env file and added a FB_ID=21221
then I go to babel and edited like this:
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo', 'react-native-dotenv'],
plugins: ['react-native-reanimated/plugin'],
};
};
I restarted it and want to access FB_ID but its not exists
Solution 1:[1]
react-native-dotenv maintainer. This is an old version of the documentation. The new documentation is on npm. This library is now a plugin not a preset. try plugins: ['react-native-reanimated/plugin', 'module:react-native-dotenv']. Also, the api.cache(true) doesn't help. Try api.cache(false) instead.
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 | Kemal Ahmed |
