React 基礎核心知識點

2021-09-24 14:27:28 字數 1906 閱讀 4881

1、fragment可以作為react元件的佔位符,使它在dom中不顯示最外層的div

import react, from 'react';

class todolist extends component

}export default todolist;

2、資料驅動響應
import react, from 'react';

class todolist extends component }

render()

handlechange(e));

// uncaught typeerror: cannot read property 'state' of undefined

this.state.inputvalue = e.target.value; }}

export default todolist;

3、todolist列表動態新增,刪除
import react, from 'react';

class todolist extends component }

render()

handlechange(e) );

// uncaught typeerror: cannot read property 'state' of undefined

// this.state.inputvalue = e.target.value; }

handbtnclick()

); }

handitemdelete(index)

); }}

export default todolist;

4、jsx語法細節

5、元件間的傳值

父子元件之間通訊:

import react, from 'react';

class todoitem extends component

render()>

) }

handclick() }

export default todoitem;

6、todolist優化**
import react, from 'react';

import todoitem from './todoitem';

import './style.css';

class todolist extends component

this.handlechange = this.handlechange.bind(this);

this.handbtnclick = this.handbtnclick.bind(this);

this.handitemdelete = this.handitemdelete.bind(this); }

render()

gettodoitem()) }

handlechange(e) ));

// this.setstate(); }

handbtnclick() )); }

handitemdelete(index)

}); }}

export default todolist;

import react, from 'react';

class todoitem extends component

render() = this.props;

return () }

handclick() = this.props;

itemdelete(index); }

}export default todoitem;

Eureka核心知識點

一 eureka特性 1.當註冊中心掛了,客戶端之間依然可以通過原有的登錄檔進行呼叫 註冊中心重啟後,客戶端會繼續註冊進來 2.當服務提供者掛了,在關閉自我保護的情況下,註冊中心在規定時間 預設是60s 內移除客戶端 關閉eureka註冊中心的自我保護模式,配置如下 eureka server en...

Eureka核心知識點

一 eureka特性 1.當註冊中心掛了,客戶端之間依然可以通過原有的登錄檔進行呼叫 註冊中心重啟後,客戶端會繼續註冊進來 2.當服務提供者掛了,在關閉自我保護的情況下,註冊中心在規定時間 預設是60s 內移除客戶端 關閉eureka註冊中心的自我保護模式,配置如下 eureka server en...

Redis核心知識點

快照間隔內的資料會丟失 如果資料量很大,儲存快照時間會比較長 同步選項 always 每個命令同步 everysec 每秒同步一次 no 系統決定 redis會把設定了過期時間的key放在單獨的字典中,定時遍歷來刪除到期的key。為了保證不會迴圈過度,導致卡頓,掃瞄時間上限預設不超過25ms。根據以...