Replies: 1 comment
-
My tips here would be to have a constants object and import from there App.tsx import {IS_DEVELOPMENT} from './constants' constants.tsx const constants = {
IS_DEVELOPMENT: process.env.IS_DEVELOPMENT === 'true' ? true : false
};
export default constants; The counterintuitive part here is that the value you are checking for is not the default. i.e. if no value is set, it will take the default. So if you don't put a value, the above will default to false. if you do I will be covering this in my course I'll be launching this weekend. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have boolean value in my
.env
file written like this:And declared my
env.d.ts
like this:but when I use it in code:
not expected output is:
In the previous version (
2.6.2
) we did the patch withdotenv-parse-variables
for this (but I generally don't prefer patched solutions).How do you solve this?
Can we somewhere say to the library that we actually want load env variables as booleans?
What are yours tips&tricks?
Beta Was this translation helpful? Give feedback.
All reactions