![](/img/trans.png)
[英]Jest - ReferenceError: __DEV__ is not defined (React Native)
[英]How to use the variable __DEV__ in ReactJs like in react-native?
在我的 react-native 項目中,我使用了全局變量__DEV__
並且我想在我的 Typescript reactJs 項目中使用類似的東西,但是當我嘗試使用它時,我得到了這個錯誤:
ReferenceError: __DEV__ is not defined
我怎樣才能做到這一點?
全局變量process
具有允許實現此目的的屬性:
const isDev = process.env.NODE_ENV === 'development';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.