第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么react里只用componentDidMount()獲取數(shù)據(jù)render給我執(zhí)行了4次

為什么react里只用componentDidMount()獲取數(shù)據(jù)render給我執(zhí)行了4次

Cats萌萌 2019-03-05 08:50:40
@connect(({ editnews,global, loading }) => ({  global,   editnews,   loading: loading.models.editnews,   timeLoading: loading.effects['editnews/getCollections'], }))componentDidMount() {     message.warning("請修改參數(shù)點(diǎn)擊搜索,篩選展示數(shù)據(jù)!",10)     const { dispatch} = this.props;     dispatch({      type: 'editnews/getCollections',       payload: {}     });   }render() {    const {       editnews: { data, data: { pagination }, collections },       loading,       timeLoading,     } = this.props;     console.log(pagination)
查看完整描述

2 回答

?
jeck貓

TA貢獻(xiàn)1909條經(jīng)驗(yàn) 獲得超7個贊

在一個組件中 stateprops改變 都會執(zhí)行render方法,可能是因?yàn)槟愕钠渌麛?shù)據(jù)發(fā)生了改變;
如果不想執(zhí)行render方法,可以在 shouldComponentUpdate 方法中進(jìn)行判斷,return false就可以阻止render,這也是react官方推薦的解決方案。

查看完整回答
反對 回復(fù) 2019-03-05
  • 2 回答
  • 0 關(guān)注
  • 6153 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號