Select.Async returns undefined
See original GitHub issueHi,
I’m writing about a curious case. (Just followed the given documentation). First off is it broken?
utils/requests/schools
import axios from 'axios'
import 'utils/interceptors'
export function search (id) {
return (query) => {
return axios.get(__API__ + '/division/' + id + '/school', {
params: {
query: query
}
})
.then((response) => {
return response.json()
})
.then((json) => {
return {
options: json
}
})
}
}
react component
import React, { PropTypes } from 'react'
import Select from 'react-select'
import { search } from 'utils/requests/schools'
class MyExampleView extends React.Component {
render () {
return (
<div className='panel'>
<Select.Async
loadOptions={search(this.props.params.id)}
autoload={true} />
</div>
)
}
}
It seems that Async
is undefined.
I tried
import { Async } from 'react-select'
console.log(Async) //returned undefined
import Select from 'react-select'
console.log(Select.Async) //returned undefined
Why do you think is that?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9
Top Results From Across the Web
JS async function returning undefined although calling it ...
log(userInfo) // It's result is undefined if (userInfo) { res.render('dashboard/profile', { fullName: userInfo.fname + " " + userInfo.
Read more >Async/Await returning undefined : r/learnjavascript - Reddit
Hi, I'm just learning about async/await, and more generally, callbacks/promises. In the example below, erpBaseUrl within the newOrder ...
Read more >async function expression - JavaScript - MDN Web Docs
An async function expression can be used as an IIFE (Immediately Invoked Function Expression) which runs as soon as it is defined. See...
Read more >Async/Await Error Handling - Beginner JavaScript - Wes Bos
You often have a function with a few promises inside of it, but then you want to wait for that entire function to...
Read more >Handling `undefined` in React Query and Typescript - neldeles
Generally, on the first render cycle, data will be undefined because well, the data is async and does not exist yet on the...
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
Possibly the issue here is that Select.Async only works with version 1.0.0 of react-select onwards. The documentation is now showing 1.0.0 syntax, but doing an npm install for react-select will currently get the 0.9.x version, so the docs are then wrong for that version.
I have just found this out the hard way!
@aeleftheriadis fixed it with:
note: i didn’t use
Select.Async
, i usedSelect