Skip to content

let asyncOptions accept promises #491

@dmatteo

Description

@dmatteo

Looking at the doc here https://github.com/JedWatson/react-select#async-options and after having tried a bit, it doesn't seem that asyncOptions is able to use promises.

Being able to do something like this would be great:

  render() {

    return (
      <Select
        name={this.props.name}
        asyncOptions={this.fetchOptions.bind(this)}
        onChange={this.handleChange.bind(this)}
        valueRenderer={this.renderValue}  />
    );
  }

  fetchOptions(query) {
    return fetch(`some/uri/with/${query}`)
      .then((response) => {
        return response.json();
      })
  }

Any support or interest for a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions