reactjs - react tbody 上的关键道具警告
问题描述
我得到一个
列表中的每个孩子都应该有一个唯一的“关键”道具。
在 tbody 线上,我不知道为什么。该组件的每个子组件都有键,从外观上看,它在 LocationListItem 组件中没有警告。我觉得我只是不明白一些事情。
<Table striped bordered hover>
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>PostalCode</th>
<th>Phone Number</th>
<th>Tax Rate</th>
</tr>
</thead>
<tbody key="tbody">
{stores.map((item: any, index: number) => {
if (item.LTPMerchantId == null) {
item.LTPMerchantId = "";
}
if (item.ChaseOrbitalMerchantId == null) {
item.ChaseOrbitalMerchantId = "";
}
if (item.CYBSMerchantId == null) {
item.CYBSMerchantId = "";
}
return (
<>
{
<LocationListItem key={index} LTPMerchantId={item.LTPMerchantId} ChaseOrbitalMerchantId={item.ChaseOrbitalMerchantId} CYBSMerchantId={item.CYBSMerchantId} alert={props.alert} StoreId={item.StoreId} HoursId={item.HoursId} AddressId={item.AddressId} Name={item.Name} Address={item.Address} Address2={item.Address2} City={item.City} State={item.State} PostalCode={item.PostalCode} PhoneNumber={item.PhoneNumber} TaxRate={item.TaxRate} Latitude={item.Latitude} Longitude={item.Longitude} Radius={item.Radius} Sunday={item.Sunday} Monday={item.Monday} Tuesday={item.Tuesday} Wednesday={item.Wednesday} Thursday={item.Thursday} Friday={item.Friday} Saturday={item.Saturday} />
}
</>
);
})}
</tbody>
</Table>
解决方案
推荐阅读
- c++ - 自定义lua字节码/操作码(编译器/阅读器/解析器/反编译器)
- azure - Azure AD B2C - 自定义 Azure AD 自定义身份提供程序的 UI
- python-3.x - Trim text from scraped element - Python / bs4
- python - 我正在尝试下载 pygame,但它一直出现相同的错误(错误:命令 'gcc' 失败,退出状态为 1)?
- windows - 在 windows 中替换 create_symlink
- javascript - bcryptjs 或 bcrypt 如何验证使用随机盐生成的密码哈希?
- c++ - How to avoid implicit conversions from integer 0 to pointer, as the element of a vector
- nim-lang - 声明空表时出现内部错误
- sql - ASP.NET API 中多个值的 JSON 数组
- regex - grep 正则表达式用于返回字符串之间的数值