I'm starting to learn react
native and I have a lot of questions about how to structure my project. I'm creating a game of the old one, which has the following configuration:
Home As you can see, each component resides in its own js file.
I'm wondering where is the best place to put the game logic, I mean, let's assume I have a 3x3 array as an attribute of my root component (assuming the component structure is a tree) and the leaves are the empty spaces where we can mark 'X' or 'O'.
How do you communicate the leaves to the root? For example, by clicking on an empty space, I invoke a putMarkOn (row, col)
method, which would be in the game class, for example.
The image shows the structure of the components, what I want to know is ... where to insert logic, maybe in an external file called GameLogic?
How to update the game state, according to the touch interaction?