The problem of React using Select components of Antd to dynamically transform Option

there are two Select selection boxes.
the data source of the first Select box is the value already passed by the background when the page is rendered. The option of the
second Select box needs to be dynamically changed according to the selection result of the first Select box.
is not a traditional cascade. The Option of the second Select depends on the result of the first Select and is updated to the foreground after dynamic calculation by the background.

in this case, how do you define the Option of the second Select?

Mar.11,2021

it's no different. After the first Select is selected, the data returned by ajax, can be updated with data.
for example:

ajaxCall = () => {
    ajax().then(changeList2)
}

renderOptions = () => {
    return this.props.list.map(element =>
      <Option key={element.id} value={element.id}> {element.address}</Option>);
  };


<Select onclick={ajaxCall}>
    <Option>value1</Option>
</Select>
    
<Select>
    {renderOptions()}
</Select>

to put it bluntly, it's just a matter of data. You don't need to care about how to render, you just need to care about how the data comes from and how to convert it to a format that Select can render

.
Menu