javascript - React only re-render changed elements in grid -
i have grid of rectangles state of managed redux. however, when 1 of rectangles has value updated say, incrementing value, entire grid re-rendered. can tell because have color being randomly generated on render cycle, , of squares color's change. however, ideally square updated re-render.
you should use purecomponent listitem , update card style inside listitem itself. way boxes update 1 one when related redux-state updated.
https://codesandbox.io/s/n33k03yxkp
read purecomponent , shouldcomponentupdate() function in react docs: https://facebook.github.io/react/docs/react-api.html#react.purecomponent
Comments
Post a Comment