Load options on the first open of the Async drop down menu
Solution demo: https://codesandbox.io/s/o51yw14l59
I used the Async options loaded externally
section from the react-select repo.
We start by loading the options on the Select's onFocus
and also set the state to isLoading: true
. When we receive the options we save them in the state and render them in the options.
I also keep track of optionsLoaded
so that only on the first focus
do we trigger the call to get options.