[英]Is there a way to see all static variables and methods of a class in Typescript or ES6?
[英]Static Class Variables ES6
在 ES6 中使用 static 屬性是個好主意嗎? 我的一些同事認為這是一個壞主意,但我沒有很好地解釋為什么會這樣。
I am building a ReactJs application, and I use redux wherever necessary, however, when I want to share some data with all the components in the app, can I use static class properties?
在我的例子中,我們希望在所有組件之間共享一個名為ThemeName的變量的值。 請注意,組件不會監聽此變量的更改。 它只是在加載時獲取變量的值。
它實際上沒有任何問題,但不知何故我覺得它可能是反模式,有人可以在這里解釋這個問題,如果有的話?
將 static 屬性與 React一起使用並不是一個好主意,原因如下:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.