Skip to content

ElistratovRoman/react-suggestions

Repository files navigation

react-suggestions

Reactjs component for dadata suggestions

Example

In dev mode

yarn
yarn add react react-dom -P
API_KEY={ your dadata token } yarn start

Install

yarn add react-suggestions

Usage

import React from 'react'
import ReactSuggestions from 'react-suggestions'
import 'react-suggestions/react-suggestions.css'

export default class Example extends React.Component {
  render() {
    return <ReactSuggestions token={ your dadata token } onChange={ this.handleChange }/>
  }

  handleChange = (selected) => {
    console.log(selected)
  }
}

Options

Properties Type Default Description
token string '' dadata token
query string '' searh query
count number 10 suggestions length
min number 2 minimum length for init request
delay number 0 debounce delay
locations array [] limit the search area
onQueryChange func () => {} callback is fired on every time the input value changes

...other input attributes

About

React-component for work with dadata address suggestions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published