如何从数据库中导入实时搜索中的公司列表?

时间:2015-09-14 09:32:03

标签: reactjs reactjs-flux

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>
    );
  }
};

我有一个公司列表,一个组件 如何连接到实时搜索?我是新手,无法连接数据库中的数据

0 个答案:

没有答案