Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

antd design select placeholder issues

Tags:

I am using antd design in my React app.

Here's a code snippet where I am facing the issues :

<Select      showSearch      optionFilterProp = "children"      placeholder = "Select Company"      value = "{this.state.company}"      name = "company"      onSelect = "{this.handleCompanyChange}"     > 

Now it shows the correct value selected if this.state.company is not null. But if this.state.company is empty or null, placeholder doesn't shows up.

How can I solve this issue so that the placeholder appears if value is null?

like image 684
FE_Addict Avatar asked Aug 07 '17 11:08

FE_Addict


1 Answers

set this.state.company to be undefined instead of null.

like image 199
afc163 Avatar answered Oct 18 '22 09:10

afc163