我在一个网球应用程序中工作,我在管理许多州时遇到了问题.我会解释:网球锦标赛第一轮有128名这样的球员,每一行都有球员和种子选手.
Array.from
const oddIndex = index * 2 + 1
const evenIndex = index * 2 + 2
const getCurrentSeed = (position) => {
const seed = !objectIsEmpty(games) && games?.rounds[round.round]?.positions[position]?.seed
return seed || ''
}
const getCurrentATPPlayer = (position) => {
const ATPPlayer = !objectIsEmpty(games) && games?.rounds[round.round]?.positions[position]?.atp_player
return ATPPlayer || {}
}
<div className="player">
<ATPPlayerFinderWrapper position={oddIndex} setATPPlayerId={setATPPlayerId} setCurrentPosition={setCurrentPosition} ATPPlayer={getCurrentATPPlayer(oddIndex)} />
</div>
<div className="seed">
<TextField
id={`seed${oddIndex}`}
label="Seed"
variant="standard"
onChange={(e) => setSeed(e.target.value)}
InputProps={{ disableUnderline: true }}
value={getCurrentSeed(oddIndex)}
/>
</div>
});
我的大问题是,当我从后面获得行时,我需要每个文本字段的状态,但它不起作用,可能会很多.