I want to be able to pull the undefined elements out of the array, so that my table can correctly display the values. Currently I have this problem, where the following table shows the data corresponding to those tables, but it seems that the arrays occupy positions with the data that cannot be displayed, and I would like to remove them from the array: capture
this is the code:
team.playerHasTeams.map((player) => {
playersInTeamData.push({
idTeam: team.id,
playerName: player.bookings.full_form_data.name,
lastName: player.bookings.full_form_data.lastname,
location: player.bookings.full_form_data.location,
dateBirth: player.bookings.full_form_data.birth_date,
gender: player.bookings.full_form_data.gender,
position: player.bookings.full_form_data.position
})
})
let formatedData = playersInTeamData.map((player, index) => {
if (player.idTeam === team.id) {
return {
key: index,
assingTeam: (
<Form.Item>
<Select placeholder="Assign">
{searchResponse.map((team, index) => (
<Select.Option key={index} value={team.id}>
{team.official_name}
</Select.Option>
))}
</Select>
</Form.Item>
),
playerName: player.playerName,
lastName: player.lastName,
location: player.location,
dateBirth: player.dateBirth,
gender: player.gender,
position: player.position
}
}
})