Semantic-UI-React, selection, multi, can't set defaultValue

我怕爱的太早我们不能终老 提交于 2019-12-03 16:34:54

defaultValue cannot be an object for semantic-UI-react. It can only be a value. http://react.semantic-ui.com/modules/dropdown. If you look at the props of defaultValue, the docs say that it can be a string, number, or arrayOf.

I usually set mine to value of the dropdown - using immutabilityJS - when it is switched onChange.

<Dropdown
    placeholder={field[propName].label}
    id={propName}
    fluid
    multiple
    selection
    search
    defaultValue={dropdownList.get('forWhat')}
    options={options}
    onChange={(e, {value}) => this.updateDropdownList('forWhat',[value:value, text:"works"])}
/>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!