Value do not get selected in async component
See original GitHub issuePlease have a look at this code, When I click on the drop down it shows 10 values, If I select any value from these values it get selected.
But when i search in drop down for example if I type test. It then shows 10 values matching the given string ( test ). But if i try to select any value from the new data set ( which matched the ‘test’ input ) value do not get selected.
getOptions = (input: string, callback: Function) => {
this.props.action(
input,
/* callback */
(res: Object): void => {
if ( res && res.data ) {
callback(null, { options: res.data });
} else {
callback([]);
}
}
);
};
render() {
const { name, label, value, multi, placeholder, onChange } = this.props;
return (<Async
name={name}
label={label}
value={value}
placeholder={placeholder}
autoload
loadOptions={this.getOptions}
onChange={onChange}
async
multi={multi}
/>);
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Selected value is not displayed in async mode - Stack Overflow
I was hoping for a fix since I have the same problem on another component and having the value disappear after the user...
Read more >How to use the react-select.Async function in react-select | Snyk
To help you get started, we've selected a few react-select.Async examples, based on popular ways it is used in public projects.
Read more >Async Data Fetching with React-Select - OpenReplay Blog
When this button is clicked, the fetch request runs, and another set of names will be added to the options list. import {...
Read more >Advanced - React Select
A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete and ajax support.
Read more >react-select: An introduction - LogRocket Blog
How do you get the value out of react-select? I've set up a working react-select async component that pulls data from an external...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I am passing
{ value: '...', label: '...' }
but it does not seem to display the selected value in the box. here is my component. when i select an item my state variable holds{value: "3", label: "ACG_242-0_non_working_flows_to_test_-Template-v6.3.xls"}
which gets passed onto theAsync
component but it does not display the value even though it is in the list@saadbinsaeed Doc just dont get updated yet. i will do this tommorow. u need to pass {value: ‘’, label: ‘’} instead of string