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