第 2 組讀書會 2-6 ~ 2-7 #19
robertyen2023
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
HackMD 筆記連結
導讀人: Var
筆記工: Robert
本週簡報連結
2024/3/20 2-6 ~ 2-7
1. 導讀討論
1.1. Component 首字大寫
2. 觀念自我檢測
2.1. 單向資料流是什麼
2.2. 實現單向資料流常見的渲染策略有哪些?分別的優缺點是什麼?
2.3. React 為了維護單向資料流所採用的渲染策略為何?怎麼解決該策略的缺點?
2.4. 什麼是 component?
2.5. 什麼是抽象化
2.6. 什麼是 props?為什麼 props 是唯讀的?
2.7. 為什麼 component 命名中的首字必須大寫?
3. 問題討論
3.1. pg 122, 開發環境版本、Object.freeze
4. Zet 的講解
4.0. Discord討論區的問題:React Element 用 <Tag> vs call function() 的寫法差異
4.1. What would the content be if u consolelog a component?
4.2. 下列程式碼,當執行完 line 1,已經來到 line 2,則 the Foo Component 已經被呼叫到了沒?該 function 有沒有被至少呼叫 1 次?
4.3. 兩種 呼叫方式 的差別
<Foo />
Foo()
4.3.1. [呼叫方式 1.] ==不會== 馬上呼叫 Component Function
4.3.2. React不會用首字母大寫來決定是否為Component,也不會根據定義方式
React.createElement(b, ...)
React.createElement('b', ...)
Foo()
對 React 來說,完全不覺得要建立一個 Component (見 4.3.3.)4.3.3. 用 React Developer Tools 檢視 兩種呼叫方式 的 結果
4.4. 為何要用 React.createElement 的方式呼叫,這樣的設計有什麼好處
4.4.1. 為了達成 延遲呼叫
<Component />
only means that u pass [the function / component] to React.createElement as an argument,還沒有被執行==4.4.2. 為什麼用 function call 的方式 不會 產生Component
const foo = ({ yo }) => (<div>{yo}</div>);
is fine even with props passing in4.4.3. 延遲呼叫的另一好處:使 不用 每次都 re-render the component that is [in the specific condition],在運作上更有效率
Beta Was this translation helpful? Give feedback.
All reactions