我正在尝试使用本指南来创建下拉细化列表而不是默认值。我首先在这里创建了一个Dropdown.js内容表单
import React, { Component } from 'react';
import { connectRefinementList } from 'react-instantsearch/connectors';
import PropTypes from 'prop-types';
const cx = label => `ais-DropdownRefinementList-${label}`;
/// Rest of the code from the above link follows
export default connectRefinementList(DropdownRefinementList);
然后我将它导入到我的search.js组件中,它构建了我的界面,如下所示:
import { DropdownRefinementList} from "./Dropdown"
并像这样使用它:
<DropdownRefinementList attribute="major" />
这给了我以下错误:
×
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of `SearchGrid`.
SearchGrid只是我的搜索组件。当我删除时问题就消失了<DropdownRefinementList attribute="major" />,所以这一定是问题所在。
我的实现有问题吗?我怎样才能解决这个问题?