https://github.com/wizardone/fetch-autocomplete
Autocomplete input field, using the fetch api
https://github.com/wizardone/fetch-autocomplete
autocomplete es2015 fetch-api javascript json react
Last synced: about 2 months ago
JSON representation
Autocomplete input field, using the fetch api
- Host: GitHub
- URL: https://github.com/wizardone/fetch-autocomplete
- Owner: wizardone
- Created: 2017-01-05T15:38:19.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-08T09:16:08.000Z (over 9 years ago)
- Last Synced: 2025-10-10T23:19:20.964Z (9 months ago)
- Topics: autocomplete, es2015, fetch-api, javascript, json, react
- Language: JavaScript
- Homepage:
- Size: 24.4 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-autocomplete
[](https://travis-ci.org/wizardone/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:
```javascript
import { FetchAutoComplete } from 'fetch-autocomplete'
```
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:
```json
{
"search": "value"
}
```
The response format needs to look like this:
```json
{
"data": [
{"identifier": "title", "value": "mysearch", "url": "http://dummy.com"},
{"identifier": "title", "value": "searchme", "url": "http://test.com"}
]
}
```
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 ;)