omer
omer

Reputation: 1440

loadOptions is not called when AsyncSelect is wrapped by another component

I have a component that wraps a react-select AsyncSelect component:

<Wrapper
  id={id}
  values={values}
  loadOptions={this.loadOptions}
/>

The wrapper component's render() function looks like this:

render() {
  return (
    <AsyncSelect
      defaultValue={this.props.values}
      placeholder={placeholder || "Select..."}
      cacheOptions
      defaultOptions
      isMulti={true}
      name={this.props.id}
      {...this.props}
    />
  );
}

However, loadOptions is not being called at all. If I get rid of the wrapper component, and use AsyncSelect directly in the parent component, everything is working as expected.

What am I missing here?

Upvotes: 3

Views: 221

Answers (0)

Related Questions