Allows players to review a game’s history and see previous versions of a game’s board. Here's an example of a simple page component. Keeping the state of all squares in the Board component will allow it to determine the winner in the future. Let’s discuss what the above warning means. In the tic-tac-toe game’s history, each past move has a unique ID associated with it: it’s the sequential number of the move. We’ll change the renderSquare method in Board to: We split the returned element into multiple lines for readability, and added parentheses so that JavaScript doesn’t insert a semicolon after return and break our code. This is why Square currently ignores the value prop passed to it by the Board. so let's add code as bellow: src/DemoForm.js. If we were displaying data from a database, Alexa, Ben, and Claudia’s database IDs could be used as keys. React components can have state by setting this.state in their constructors. Because React cannot know our intentions, we need to specify a key property for each list item to differentiate each list item from its siblings. Examples might be simplified to improve reading and learning. Each child in an array or iterator should have a unique “key” prop. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. A component takes in parameters, called props (short for “properties”), and returns a hierarchy of views to display via the render method. We will also replace reading this.state.history with this.state.history.slice(0, this.state.stepNumber + 1). By inspecting the code, you’ll notice that we have three React components: The Square component renders a single