0
const {document} = this.props
和({document} = this.props)
有什麼區別?我在很多情況下使用const {document} = this.props
,並且我想知道它是否會影響應用性能?const {document} = this.props和({document} = this.props)有什麼區別
const {document} = this.props
和({document} = this.props)
有什麼區別?我在很多情況下使用const {document} = this.props
,並且我想知道它是否會影響應用性能?const {document} = this.props和({document} = this.props)有什麼區別
/* document key from this.props is stored in const document
& it called destructing object (introduced in es6) */
const {document} = this.props;
而({document} = this.props)以可變的關鍵文件返回對象。意思是如果您稍後更改文檔值,它也會反映在this.props中(不推薦)。
好的。你是否知道const對應用性能的影響?我想知道是因爲我在列表中創建了很多項目,而這些項目又是'const {document} = this.props;'是否有任何指導原則?使用const的 – MichelH
不會有任何性能影響 – Moniv