seatsio / seatsio-react

The official Seats.io React wrapper
https://www.seats.io
MIT License
22 stars 15 forks source link

track the state of booked objects #197

Open Tomekmularczyk opened 6 months ago

Tomekmularczyk commented 6 months ago

Hi! Just started using the package and seems there is no way of tracking the state of booked objects somewhere in the parent component. The basic use case would be to prevent the user from going to the next step of the flow:

const [bookedObjects, setBookedObjects] = useState([])

<SeatsioSeatingChart
  ....
/>
<button onClick={goNext} disabled={bookedObjects.length === 0}>Go to the next step</button>

EDIT:

I've found out about this solution which is to use onObjectSelected and onObjectDeselected. This solves my issue but I was rather thinking about something like onSelectedObjectsChange which would not require me to implement this two functions above.