import css from './SearchField.styl';
import React, { Component } from 'react';
import CN from 'classnames';
import CompanyList from 'Company/List/CompanyList';
import Autosuggest from 'react-autosuggest';
const suburbs = ['Cheltenham', 'Mill Park', 'Mordialloc', 'Nunawading'];
export default class SearchInput extends Component {
render() {
function getSuggestions(input, callback) {
const regex = new RegExp('^' + input, 'i');
const suggestions = suburbs.filter(suburb => regex.test(suburb));
setTimeout(() => callback(null, suggestions), 300); // Emulate API call
}
return (
<div className={CN(css.selectLive)}>
<Autosuggest suggestions={getSuggestions} />
</div>
);
}
};
我有一个公司列表,一个组件 如何连接到实时搜索?我是新手,无法连接数据库中的数据