gunjan4455 / React-country-select

Component commonly used in form for listing of all the countries with their flag icon.
5 stars 12 forks source link

defaultValue/value not working to set the default value #3

Open ibudisteanu opened 7 years ago

ibudisteanu commented 7 years ago

I was looking to set a default value for the react-country-select component using the following code:

value="RO" value="Romania" defaultValue={"RO"}

And absolutely no luck for me. How do you set the default value of this drop down list selector?

simenandresen commented 7 years ago

I have the same problem. Would be great if one could set a defaultValue

ibudisteanu commented 7 years ago

@simena86 I ended up building my own React-Country-Select using pure React-Select examples. https://github.com/ibudisteanu/SkyHub-Frontend-React-Isomorphic/blob/master/src/client/components/util-components/select/MyCountry.select.component.js it has less than 200 lines of code. Take a look

simenandresen commented 7 years ago

@ibudisteanu will probably use this one. thanks alot :+1:

ibudisteanu commented 7 years ago

Sure. You can see the usage demo in the Registration.form or AddForum.form

Rody-Kirwan commented 6 years ago

I have made a PR to fix this issue - https://github.com/gunjan4455/React-country-select/pull/4 Can you merge it please? @gunjan4455