gurugu-fcc-projects / FCC_game_of_life

FreeCodeCamp --- Game of Life project

Home Page:https://gurugu-fcc-projects.github.io/FCC_game_of_life/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FIX --- optimization

GuRuGuMaWaRu opened this issue · comments

It should rerender only when SIZE state is changes, I should not care about GAMEBOARD or MOUSEDRAG state

Use shouldComponentUpdate or PureComponent to optimize performace --- rerender Gameboard component only when size changes (the only thing that matters for rendering gameboard as a whole), and remake Gameboard cells into separate components and have them rerender when their alive property changes.

Look like replacing object-based gameboard structure with an array-based one didn't help.
If only there was a way to do the whole process differently.

  • check for allDead during setInterval action
  • change alive-dead class of cells using classList instead of state