About
This is a hook, useAutocomplete
, that returns autocomplete values using a prefix tree. This is for front-end autocompletion rather than remote autocompletion, which is more commonly used.
Use it in any input component, see examples for more.
How to install
Run the following to install the hook
yarn install react-autocomplete
How to use
Import from use-autocomplete
and pass in the search term and list of values. Small example:
With fake data
;; ; const Example = { const textState setTextState = ; const completions = ; return <div> <input type='text' value=textState onChange= /> <div> completions </div> </div> ;};
Data conversion
;; const Example = { const textState setTextState = ; const completions = ; return <div> <input type='text' value=textState onChange= /> <div> completions </div> </div> ;};
Contributing
Pull requests welcome!