# fetch-autocomplete

> An autocomplete input field written in React and using the Fetch API

Latest version **1.2.0** (published 2017-03-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install fetch-autocomplete
pnpm add fetch-autocomplete
yarn add fetch-autocomplete
bun add fetch-autocomplete
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2017-03-08 |
| First published | 2017-01-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Stefan Slaveykov |
| Maintainers | wizardone |
| Keywords | react, autocomplete, form, fetch |

## Links

- npm: https://www.npmjs.com/package/fetch-autocomplete
- Repository: https://github.com/wizardone/react-autocomplete
- Homepage: https://github.com/wizardone/react-autocomplete#readme
- Issues: https://github.com/wizardone/react-autocomplete/issues
- npm.io page: https://npm.io/package/fetch-autocomplete

## Dependencies (11)

- [react](https://npm.io/package/react.md) ^15.4.2
- [webpack](https://npm.io/package/webpack.md) ^1.14.0
- [babel-cli](https://npm.io/package/babel-cli.md) ^6.18.0
- [react-dom](https://npm.io/package/react-dom.md) ^15.4.2
- [babel-core](https://npm.io/package/babel-core.md) ^6.21.0
- [babel-loader](https://npm.io/package/babel-loader.md) ^6.2.10
- [babel-preset-react](https://npm.io/package/babel-preset-react.md) ^6.16.0
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.18.0
- [babel-preset-es2016](https://npm.io/package/babel-preset-es2016.md) ^6.16.0
- [babel-preset-es2017](https://npm.io/package/babel-preset-es2017.md) ^6.16.0
- [babel-preset-stage-1](https://npm.io/package/babel-preset-stage-1.md) ^6.16.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2017-03-08
- 1.1.1 — 2017-01-27
- 1.1.0 — 2017-01-27
- 1.0.0 — 2017-01-27

## README

# react-autocomplete
[![Build Status](https://travis-ci.org/wizardone/fetch-autocomplete.svg?branch=master)](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'

<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:
```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 ;)

---
_Source: https://npm.io/package/fetch-autocomplete · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
