所以我正在为我的网站开发一个搜索栏,我在使用其中一个组件react-select时遇到了一些麻烦。下面是一些示例代码
const baseOptions = [
{ label: 'Users', options:
[
]
},
{ label: 'Pages', options:
[
]
},
{ label: 'Search Google Index', value: 'search_google_index', type: "google_index" },
{ label: 'Search Bing Index', value: 'search_bing_index', disabled: 'yes' },
]
handleSearchChange = selectedOption => {
this.setState({
selectedOption,
}, () => {
console.log(`Option selected:`, this.state.selectedOption);
switch (this.state.selectedOption.type) {
case "user":
window.location = "/@" + this.state.selectedOption.label
break;
case "google_index":
console.log("Searching google index");
/*Here is where I need to catch the …Run Code Online (Sandbox Code Playgroud)