简体   繁体   中英

How to clear AntDesign select?

I use React Ant Design and i need to clear selected value in AntD select. How can i do this without using value prop ?

Example

You can try prop allowClear of Select

<Select
   mode="tags"
   style={{ width: "100%" }}
   onChange={handleChange}
   tokenSeparators={[","]}
   allowClear
>
  {children}
</Select>

在此处输入图片说明

Created stackblitz for you. It is not easy to programmatically clear the value of antd-select, but it can be done with fireChange

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