React.js——開發要點&&優化(二)

組件更新的優化 開發當中存在這樣的場景好比,我已經獲得的一個組件中渲染了,另外一個組件渲染後,前一個組件也會隨着更新,這個勢必會影響性能,React提供了shouldComponentUpdate(nextProps, nextState)來解決這類問題 基本語法:html shouldComponentUpdate(nextProps, nextState) { return true;
相關文章
相關標籤/搜索