我为我的应用程序 React 创建了一个 React 选择组件,并且有超过 70 个选项,为此我想定义用户可以选择的选项的最大限制以很好地处理它。你能帮我么?
\n代码:
\nexport default function ReactSelect(props) {\n const animatedComponents = makeAnimated();\n return (\n <Select\n isMulti="true" // allow to select mutli options\n isRtl="true" // right to left\n name="name" // html name\n options={accountsNames} // options\n className="basic-multi-select"\n classNamePrefix="select"\n isSearchable="true" // searchable for the closest one\n placeholder="\xd8\xa7\xd8\xae\xd8\xaa\xd8\xb1 \xd8\xa7\xd8\xb3\xd9\x85 \xd8\xa7\xd9\x84\xd8\xad\xd8\xb3\xd8\xa7\xd8\xa8..." // if there is no option selected\n components={animatedComponents}\n />\n );\n}\nRun Code Online (Sandbox Code Playgroud)\n 我有一个 React 应用程序,映射卡并且每张卡都有唯一的 id,尽管我在控制台中收到错误,有些卡不是唯一的:
\n\n\n警告:遇到两个孩子使用同一把钥匙,
\n2294264。键应该是唯一的,以便组件在更新时保持其身份。非唯一的键可能会导致子项被重复和/或\xe2\x80\x94 被忽略,该行为不受支持,并且可能会在未来版本中更改。
这是构建我的卡片结构的代码:
\nfunction CreateCards(doc) {\n return (\n <SimpleCard\n key={doc.newsid}\n theCardId={doc.newsid}\n categorietitle={doc.categorietitle}\n newstitle={doc.newstitle}\n date={format(new Date(doc.date), "dd/MM/yyyy")}\n thenews={doc.thenews}\n newsurl={doc.newsurl}\n />\n );\n}\nRun Code Online (Sandbox Code Playgroud)\n这是映射卡片的代码:
\n <div className="general-card1">\n {this.state.noPlaceFound ? (\n <h3 className="noPlaceFound">\n <i className="fas fa-exclamation-circle fa-sm WarnIcon"></i>\n \xd9\x84\xd8\xa7 \xd9\x8a\xd9\x88\xd8\xac\xd8\xaf \xd9\x86\xd8\xaa\xd8\xa7\xd8\xa6\xd8\xac\n </h3>\n ) : (\n this.state.WasMap.map((v) => CreateCards(v._source))\n )}\n </div>\nRun Code Online (Sandbox Code Playgroud)\n你能帮我么?
\n