react 渲染自动排序渲染列表,如何停止排序动作

问题描述 投票:0回答:0

我正在尝试以像“03:30”这样的字符串形式呈现时间列表数据,反应自动以排序的方式呈现列表数据,我希望停止排序并以默认顺序呈现列表,我该怎么做?

<FormControl>
    <RadioGroup defaultValue="female" onChange={handleTimeSlotChange} className='time-slots__container' name="radio-buttons-group">
        {timeSlotList.map((slot) => (
            <FormControlLabel key={uuidv4()} className='time-slot__btns' value={slot.start_datetime.split(" ")[1].slice(0,5)} control={<Radio />} label={slot.start_datetime.split(" ")[1].slice(0,5)} />
            ))}
    </RadioGroup>
</FormControl>

列表看起来像这样...

{
    "slot.booking": [
        {
            "start_datetime": "2023-05-19 05:50:00",
            "doctor_id": [
                5314,
                "some text"
            ],
            "id": 290378,
            "stop_datetime": "2023-05-19 06:10:00"
        },
        {
            "start_datetime": "2023-05-19 03:30:00",
            "doctor_id": [
                5314,
                "some text"
            ],
            "id": 375123,
            "stop_datetime": "2023-05-19 03:50:00"
        },
        {
            "start_datetime": "2023-05-19 03:50:00",
            "doctor_id": [
                5314,
                "some text"
            ],
            "id": 375124,
            "stop_datetime": "2023-05-19 04:10:00"
        },

    ]
}

渲染列表看起来像这样......

javascript reactjs arrays ecmascript-6 javascript-objects
© www.soinside.com 2019 - 2024. All rights reserved.