import React from 'react'; import Autocomplete from '../../components/autocomplete'; class AutocompleteTest extends React.Component { state = { simple: 'Spain', simpleShowAll: 'England', multiple: ['ES-es', 'TH-th'], countriesArray: ['Spain', 'England', 'USA', 'Thailand', 'Tongo', 'Slovenia'], countriesObject: {'ES-es': 'Spain', 'TH-th': 'Thailand', 'EN-gb': 'England', 'EN-en': 'United States of America', 'EN-nz': 'New Zealand'} }; handleMultipleChange = (value) => { this.setState({ multiple: value, countriesObject: { ...this.state.countriesObject, ...(value[0] && !this.state.countriesObject[value[0]]) ? {[value[0]]: value[0]} : {} } }); }; handleSimpleChange = (value) => { this.setState({simple: value}); }; handleSimpleShowAllChange = (value) => { this.setState({simpleShowAll: value}); }; render () { return (
Autocomplete

You can have a multiple or simple autocomplete.

); } } export default AutocompleteTest;