Builing a Tic-Tac-Toe using react, am I going down the wrong path?

I decided to use react to build the Tic-Tac-Toe game. This is my code so far, https://codepen.io/pethaf/pen/pWRQbO?editors=0011 The thing that struck me is that it seems so brittle. I have to add special code to start it if the ai start, I have to add special code to check if there is a draw or if someone has won. To me this sounds like I need a redesign.


You will have to check if someone has won, drawn, etc. You will have to tell the AI to make it’s move, etc.

Sometimes its best to get it working first and then try to optimize later :slight_smile:.

Looks like a good start so far – I think I found a bug or two when playing around with it