Async data search filter using react

889 views Asked by At

I'm using react-select (https://github.com/JedWatson/react-select) to search async data.

This is the code:

const getOptions = (input) => {
  return fetch(`/users/${input}.json`)
    .then((response) => {
      return response.json();
    }).then((json) => {
      return { options: json };
    });
}

<Select.Async
  name="form-field-name"
  value="one"
  loadOptions={getOptions}
/>

I want to use two select box in a single page. But i'm getting same data in both component since options (return { options: json };) is same.

How can I do this?

Thank You

0

There are 0 answers