我想创建专家预测的记录,并在React中绘制排行榜。构造JSON数据的最佳方法是什么?我也想随着时间的推移更新
1)最好通过比较预测结果和在状态上存储该记录来计算每个专家记录吗?还是只有一个静态记录?
2)如果专家没有为每场比赛做出预测,我该如何处理案件?
const DATA = {
pundits: [
{ name: 'Eddie', nationality: 'uk', predictions: {1:'w', 2:'w', 3:'l', 4:'l'}, record: {wins: 0, loss: 0}},
{ name: 'Carl', nationality: 'uk', predictions: {1:'l', 2:'l', 3:'l', 4:'l'}, record: {wins: 0, loss: 0}},
{ name: 'Abel', nationality: 'us', predictions: {1:'d', 2:'d', 3:'d', 4:'d'}, record: {wins: 0, loss: 0}},
],
matches: [
{ matchId: 1, matchName:'Bellew vs Usyk', result: 'w' },
{ matchId: 2, matchName:'Bellew vs Haye', result: 'w' },
{ matchId: 3, matchName:'Fury vs Wilder', result: 'd' },
{ matchId: 4, matchName:'GGG vs Canelo', result: 'l' }
]
}