-- expected a string or a class/function but got object
Use react to implement a simple render using List like this:
import SuggestionCard from './FakeData';
<List
loading={this.props.isLoading}
itemLayout="vertical"
grid={{ column: 1 }}
size="large"
dataSource={talentSuggestions}
renderItem={item => (
<List.Item key={item.id}>
<SuggestionCard SuggestionData={item} ContactTalent={this.clickContack}/>
</List.Item>
)}
/>
export default class SuggestionCard extends Component {
render() {
const suggestionItem = this.props.SuggestionData;
return (
<Card
title="HI title">
<Card.Meta
title="Skills"
description={
<div>
<Tag>skill 1</Tag>
<Tag>skill 2</Tag>
<Tag>skill 3</Tag>
</div>
}
/>
</Card>
);
}
}
But got a error message of : React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
I checked it again and again, and then found that the error occur because of the wrong import path! I should import this component from
import SuggestionCard from './SuggestionCard';
So this bug was fixed. How ridiculous~~~
Anyway, happy development. Haha~~~~