react-autocomplete
Autocomplete field written in React. A couple of points:
- It uses Json to send data and it expects a json data to be returned
- It uses the Fetch Api.
- It is configurable.
To configure the FetchAutoComplete Component you can pass the following properties:
<FetchAutoComplete inputClass='autocomplete-field' resultsClass='autocomplete-results' mainHolderClass='autocomplete' defaultSearchText='Search...' defaultKeyPresses=3 fetchUrl='http://localhost:8888/data' fetchMethod='POST' fetchMode='cors'/>
The options that you definitely want to configure are:
fetchUrl
=> url endpoint
fetchMode
=> 'cors' or 'no-cors', depending on how you use the
autocomplete field
The request format is:
The response format needs to look like this:
Pretty much data is an array of the search results. Currently only the value
and url
are used to display the results. Future versions will use more options ;)