Sharing State - Row & Seat Components

Read about how to share state in the row component in this lesson.

Row Component

The rows in the venue body are the same as before, except we are passing the number of tickets to buy as a new prop in the object.

The Row component has gotten a lot more functionality, some of which has been taken from the Seat component. In this version of the code, the status of a seat depends on the status of the seats next to it—if two tickets are bought, then a set with an already sold seat to its right is not available. Because an individual seat can no longer contain all the data needed to ascertain its status, the status for the entire row needs to be stored in the Row component.

Here’s the Row code:

Get hands-on with 1000+ tech skills courses.