简体   繁体   中英

Attempted import error: 'Typography' is not exported from 'antd'

Antd failing to compile on specific Typographies and compiling perfectly on the others.

This is the list of what I have included on my antd-react project:

import {
  Input,
  Col,
  Row,
  Select,
  InputNumber,
  AutoComplete,
  Cascader,
  Option,
  Menu,
  Icon,
  Popover,
  Button,
  Form,
  Checkbox,
  InputGroup,
  DatePicker
} from "antd";

In this case, every Typography works expect Option which fails to compile.

I have already tried re-installing the package.json file.

There is no such component Option if you mean Select.Option in this case you need to:

import { Select } from 'antd';

const { Option } = Select;

Use the search bar to look for Option and you will notice it refers to Select .

You can check all the available components on the left sidebar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM