https://www.gravatar.com/avatar/2666212e4f1c0fd46fc24142b2390d2d?s=240&d=mp

React + Redux 常見問題

React + Redux 常見問題 Q1: Flux Pattern 是什麼? Flux Pattern 是一個單向資料流設計模式,React 中所有元件都建議採用,以單向資料流的概念避免產生 side effect 由 React 渲染出view,

JS 繼承(2): constructor 的執行順序

三個 class A, B, C,依序繼承,測試 constructor 的執行關係 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 class A { constructor() { console.log('A has been instantiated', this) } static color =

JS 繼承(1): class property跑去哪了?

探討 JS 繼承的 class property 行為 Class A extends Component 1 2 3 4 5 6 7 8 9 10 11 12 class A extends Component { static color = "red"; counter = 0; arrowOnClick = () => { console.log("A arrowOnClick"); } onClick(){ console.log("A onClick"); } } 經由 Babel 轉譯後,class properties 都會被移到 constructor