How select uses labelInValue to display parts of label after initializing and selecting options

problem description

how does select use labelInValue to display parts of text after initializing and selecting options

Code link:

https://codesandbox.io/s/q89q.

related codes

class Com extends React.Component {
  state = {
    value: {
      key: "1",
      label: "Jack"
    }
  };
  handleChange = value => {
    this.setState({
      value: {
        key: value.key,
        label: value.label
      }
    });
  };
  render() {
    return (
      <Select
        labelInValue
        value={{
          key: this.state.value.key,
          label: this.state.value.label
        }}
        style={{ width: 120 }}
        dropdownStyle={{
          width: 200
        }}
        onChange={this.handleChange}
      >
        <Option value="1" text="Jack">
          Jack (100)
        </Option>
        <Option value="2" text="Lucy">
          Lucy (101)
        </Option>
      </Select>
    );
  }
}

what result do you expect?

you want to display Jack instead of Jack at initialization, and Jack or Lucy instead of Jack or Lucy after selection

Jun.17,2021

have you solved this problem? I have encountered similar problems

.
Menu