React-select - 有没有办法只在输入字符时加载值

React-select - Is there a way to load values only on typing the characters

react-select 的默认行为是仅在单击字段时加载状态中的所有值。但是所需的字段是仅在键入字符时加载值。是否有任何 api 可用于实现此目的?

您需要 openMenuOnClick 道具:https://codesandbox.io/s/lp9yz26y4q

来自 link 的代码:

import React from "react";
import ReactDOM from "react-dom";
import Select from "react-select";

function App() {
  return (
    <div className="App">
      <Select
        openMenuOnClick={false}
        options={[
          { label: "option1" },
          { label: "option2" },
          { label: "option3" }
        ]}
      />
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);