У меня есть следующий код ..
{
this.state.rows.map((qc) =>
qc.BinsByDayByOrchardsQCs.map((qc2) =>
qc2.BinsByDayByOrchardsQCsDefects.map((qc3) =>
!defectsArray.includes(qc3.Defect) && defectsArray.sort() && defectsArray.push(qc3.Defect) &&
(<div className="row label">
<div className="column-label bold">{qc3.Defect}</div>
</div>)
)
)
)
}
Когда я использую console.log("DefectsArray",defectsArray)
Мой массив печатается и сортируется в консоли (мой желаемый порядок)
0: "Bruise"
1: "Hail damage"
2: "Sunburn"
3: "Scuff"
Однако, реакция на самом деле делает его "Солнечный ожог, ушиб, урон от града, скфф" - в основном неупорядоченный
Как мне получить вывод, напечатанный на моем console.log
?
РЕДАКТИРОВАТЬ: Внутри объекта ..
`Array(20)
0:
BinsByDayByOrchardsAreas: null
BinsByDayByOrchardsCountries: null
BinsByDayByOrchardsPickers: null
BinsByDayByOrchardsQCs: Array(1)
0:
BinsByDayByOrchards: null
BinsByDayByOrchardsID: null
BinsByDayByOrchardsQCsDefects: Array(4)
0: {BinsByDayByOrchardsQCsID: "-LbiHz7tuuJH71I_4IKw", Defect: "Sunburn", Count: 1, BinsByDayByOrchardsQCs: null}
1: {BinsByDayByOrchardsQCsID: "-LbiHz7tuuJH71I_4IKw", Defect: "Bruise", Count: 2, BinsByDayByOrchardsQCs: null}
2: {BinsByDayByOrchardsQCsID: "-LbiHz7tuuJH71I_4IKw", Defect: "Hail damage", Count: 0, BinsByDayByOrchardsQCs: null}
3: {BinsByDayByOrchardsQCsID: "-LbiHz7tuuJH71I_4IKw", Defect: "Scuff", Count: 2, BinsByDayByOrchardsQCs: null}
`