'Icon should have `type` prop or `component` prop or `children`?
Warning: Icon should have `type` prop or `component` prop or `children`.
How to troubleshoot the issue?
import React from 'react';
import { bindActionCreators,createStore } from 'redux';
import { Link, browserHistory } from 'react-router';
import { connect } from 'react-redux';
import actions from '../../actions/information/inforResource.js';
import Dropdown from '../../components/common/dropdown.js';
import ListSearch from '../../components/common/listSearch.js';
import moment from 'moment';
import {Modal, Icon, Button, Row, Col, Form, DatePicker, Select, Table, Input, Pagination, Menu, Tooltip, Drawer, message, Avatar} from 'antd';
<Icon type="delete"/>
I deleted the icon tags of the page and still reported an error. I deleted the Icon tag in the subcomponent and still reported an error.
react.development.js?99ee:335
Warning: Icon should have `type` prop or
`component` prop or `children`.
printWarning warning.js?bcd6:34
warning warning.js?bcd6:57
_default warning.js?fe52:16
Icon index.js?be01:80
renderWithHooks react-dom.development.js?cada:12938
mountIndeterminateComponent react-dom.development.js?cada:15020
beginWork react-dom.development.js?cada:15625
Solution 1:[1]
Solution is to import icon directly.
import -
import DeleteOutlined from '@ant-design/icons/DeleteOutlined';
call -
<DeleteOutlined />
'antd' version in package.json
-
"dependencies": {
@ant-design/icons": "^4.7.0",
"antd": "^4.19.5",
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Pinaki |