代碼是 react+redux+Immutable this.state = {
data: fromJS({
input1: '',
input2: ''
})
}比如說一開始寫了這個(gè),但是組件內(nèi)部,比如說某一input輸入了內(nèi)容,state跟著變化,那么還是觸發(fā)了shouldComponentUpdate然后進(jìn)行了render。那么這時(shí)組件內(nèi)部進(jìn)行 Immutable 的意義是什么?是說能保證只渲染變化的局部?那么是否意味著react的 diff算法,是根據(jù)shouldComponentUpdate來的,不用 Immutable 就無法精確定位嗎?還是說只是因?yàn)閖s的數(shù)據(jù)mutable 的問題。那么diff是發(fā)生在哪的?是與shouldComponentUpdate相互依存,還是發(fā)生在render或是其他過程?
react組件內(nèi)部使用Immutable 的意義是什么?
侃侃無極
2018-09-14 09:09:27