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.

code sandbox

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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -