-
生命周期啊
查看全部 -
state改變
查看全部 -
實例 - 名片
查看全部 -
Props屬性
查看全部 -
JSX語法2
查看全部 -
JSX語法
查看全部 -
準備開發環境
查看全部 -
為什么使用它
查看全部 -
React是什么
查看全部 -
//創建context import?React?form?"react" const?context?=?React.createContext() export?default?context;
使用context
import?ThemeContext?from?"./theme-context.js" render(){ ????<ThemeContext.Provider?value={...}> ????????<component/> ????????... ????</ThemeContext.Provider> }
import?ThemeContext?from?"./theme-context.js" render()?{ ????<ThemeContext.Consumer> ????????{ ????????????theme?=>{ ????????????????console.log(theme) ????????????} ????????} ????</ThemeContext.Consumer> }
查看全部 -
Context 的用途:
設計目的是共享那些對于組件來說全局的數據
不要僅僅為了避免在幾個層級下的組件傳遞props而使用context
查看全部 -
期待查看全部
-
1,jsx是一種語法糖,替代React.createElement()方法。
2,這個方法返回的是ReactElement對象
查看全部 -
生命周期-圖
查看全部 -
constructor(props) {
????super(props)
????this.state = {
????????comments: ['this is my first reply']
????}
}
查看全部
舉報
0/150
提交
取消