question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dropdown: Receive Warning even requested props are given

See original GitHub issue

Steps to Reproduce

  1. Copied “Search Selection” from react semantic-ui website
  2. Gathered options from database in requested format.
<Dropdown
  onChange={this.setValue.bind(this)}
  search
  selection
  options={this.state.worldOptions}
  value={value}
  placeholder="World"
/>

Expected The Dropdown shouldn’t give any warnings. Result Dropdown works fine. Can do a search and select an option. But it logs in console: Warning: Failed prop type: selection prop in Dropdown requires props: options.

Testcase If the docs show the issue, use: https://react.semantic-ui.com/modules/dropdown#dropdown-example-search-selection-two

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
SandroMiguelcommented, Feb 11, 2020

My easy way was doing like this options={someOptions || []}

6reactions
volakacommented, Jul 25, 2017

I found the problem. I was making async request in my componentWillMount lifecycle method. I was updating the state, and then using that state variable in my dropdown list.

The problem was produced because dropdown was rendered first with empty options before axios async request was done. But I was seeing the options anyway because axios returned a response and it was done so fast. So the warning was given for the first render in which the options variable was empty.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: Failed prop type: Invalid prop `as` supplied to ` ...
You need to give a function or the name of a HTML element. You are returning a React Component. ( return (<UserPlate gravatar={image}/>)...
Read more >
Dropdown
A dropdown can include a search prompt inside its menu. Dropdown state is not fully managed when using the subcomponent API. The shorthand...
Read more >
DropDownListProps - React Dropdowns Library
DropDownListProps. Represents the props of the KendoReact DropDownList component. ... If valid is set, the required property will be ignored.
Read more >
Form Select | Components
You can even define option groups with the options prop: Please select an option ... If both html and text are provided, html...
Read more >
How to validate React props using PropTypes
If a component receives the wrong type of props, ... PropTypes.exact will give warnings if extra properties exist in a component: Component.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found