I was wondering to create seat layout for the bus. So, I found this link which show how to create the map of seats.
So following is the response I get from API
{"seats":[{"width":1,"fare":"","zIndex":0,"number":"A1","type":"A1","serviceTaxAmount":"0","convenience_charge":"0","commission":"","operatorServiceChargeAbsolute":"","operatorServiceChargePercent":"0","totalFareWithTaxes":"","ladiesSeat":"","bookedBy":"","ac":"true","sleeper":"","serviceTaxPer":"0","available":"","length":1,"id":"A1","seatid":"A1","row":0,"column":1},{"width":1,"fare":"1000","zIndex":0,"number":"A3","type":"A3","serviceTaxAmount":"0","convenience_charge":"0","commission":"","operatorServiceChargeAbsolute":"","operatorServiceChargePercent":"0","totalFareWithTaxes":"1000","ladiesSeat":"","bookedBy":"","ac":"true","sleeper":"","serviceTaxPer":"0","available":"1","length":1,"id":"A3","seatid":"A3","row":2,"column":1}]}
this is what I did so far
componentDidMount() {
return fetch(seat_url)
.then((response) => response.json())
.then((responseJson) => {
this.setState({
isLoading: false,
row: responseJson.seats.row,
column: responseJson.seats.column,
}, function() {
});
})
.catch((error) => {
console.error(error);
});
}
So how to use the above response in adjacent with ROWS and COLS because rows and cols will not be constant it will be dynamic on each row and column. In Example provided from above link cols and rows are fixed. I want to access them dynamically.