I recreated the official React Tutorial using hooks.
I finished the code, but noticed the app has an extra re-render.
My code can be found here: https://codepen.io/magnusriga/pen/BbdvPp?editors=0011
To Reproduce the Issue
- Run the below CodePoint code
- Click in any random square
- Click the bottom-most button:
Go to move #1
- See the
console
: The component re-executes (meaning it re-rendered) - Note: If you click it additional times, no additional renders occur
Question 1
How do I remove the above extra re-render?
Question 2
If you look at the console in DevTools
you will see that Game
also renders twice on every single click. This does not show up in the CodePen console.
Is it possible to remove that extra re-render as well?