Reputation: 2325
I followed the Input.Search example here https://ant.design/components/input/
import { Input } from 'antd';
const Search = Input.Search;
ReactDOM.render(
<Search placeholder="input search text" onSearch={value => console.log(value)} />
, mountNode);
I got the following error:
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined
Any idea why?
It works just fine if I used the <Input .../>
component. Why does <Input.Search .../>
break?
Upvotes: 1
Views: 507
Reputation: 1221
To import Search from ant design Input your code is wrong.
The correct syntax to Import Search is Given below:-
const {Search} = Input;
Upvotes: 0
Reputation: 384
Input.Search
is imported after [email protected]
, see: https://ant.design/changelog#2.5.0
Upvotes: 2