我有一个对象,我想使用Bootstrap和REACT在一行中显示2条记录,我的代码是
const data={
name:"xyz",
mobile:1234567890,
landline:123456,
dob:19840602,
pan:XYZ1234BGS,
}
{Object.keys(data)
.map((key, i) => (
<div className="row" key={i}>
<div
className="col-sm-2"
style={{ fontSize: 12, fontWeight: "bold" }}
>
{key}
</div>
<div className="col-sm-4" style={{ fontSize: 12 }}>
{data[key]}
</div>
</div>
预期的输出-
name: xyz mobile: 1234567890
landline: 123456 landline: 123456
dob: 19840602 pan: XYZ1234BGS
实际输出-
name:xyz
mobile:1234567890
landline:123456
dob:19840602
pan:XYZ1234BGS