How to use the react-instantsearch-dom.connectAutoComplete function in react-instantsearch-dom

To help you get started, we’ve selected a few react-instantsearch-dom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 0xProject / 0x-monorepo / packages / website / ts / components / docs / search_input.tsx View on Github external
import React from 'react';

import algoliasearch from 'algoliasearch/lite';
import { Configure, connectAutoComplete, Index, InstantSearch } from 'react-instantsearch-dom';

import { CustomAutoComplete } from 'ts/components/docs/search/autocomplete';

const searchClient = algoliasearch('39X6WOJZKW', '6acba761a34d99781628c6178af1e16c');

interface ISearchInputProps {
    isHome?: boolean;
}

const AutoComplete = connectAutoComplete(CustomAutoComplete);

export const SearchInput: React.FC = ({ isHome }) => (
     {
            // console.log('searchState', searchState);
        }}
    >
        
        
        
        
    
);
github freeCodeCamp / freeCodeCamp / client / src / components / search / searchPage / SearchPageHits.js View on Github external
import React from 'react';

import {
  Highlight,
  connectStateResults,
  connectAutoComplete
} from 'react-instantsearch-dom';
import { isEmpty } from 'lodash';

import EmptySearch from './EmptySearch';
import NoResults from './NoResults';

import './search-page-hits.css';

const AllHits = connectAutoComplete(({ hits, currentRefinement }) => {
  const isHitsEmpty = !hits.length;

  return currentRefinement && !isHitsEmpty ? (
    <div>
      <ul>
        {hits.map(result =&gt; (
          <a rel="noopener noreferrer" href="{result.url}">
            <li>
              <p>
                
              </p></li></a></ul></div>
github algolia / react-instantsearch / examples / autocomplete / src / App-Mentions.js View on Github external
hit.name)}
    onSearchChange={query =&gt; refine(query)}
  /&gt;
);

AsyncMention.propTypes = {
  hits: PropTypes.array,
  refine: PropTypes.func,
};

const ConnectedAsyncMention = connectAutoComplete(AsyncMention);

const searchClient = algoliasearch(
  'latency',
  '6be0576ff61c053d5f9a3225e2a90f76'
);

const App = () =&gt; (
  
    
  
);

export default App;
github 0xProject / 0x-monorepo / packages / website / ts / components / docs / search / autocomplete.tsx View on Github external
onSuggestionsClearRequested={onSuggestionsClearRequested}
                    getSuggestionValue={getSuggestionValue}
                    renderSuggestion={renderSuggestion}
                    inputProps={inputProps}
                    renderSectionTitle={renderSectionTitle}
                    getSectionSuggestions={getSectionSuggestions}
                /&gt;
            
            {currentRefinement &amp;&amp; (
                
            )}
        
    );
};

export const AutoComplete = connectAutoComplete(withRouter(CustomAutoComplete));
github algolia / react-instantsearch / stories / MultiIndex.stories.js View on Github external
indexName="products"
        root={{
          Root: 'div',
          props: {
            style: {
              border: '1px solid red',
            },
          },
        }}
      &gt;
        
      
    
  ));

const AutoComplete = connectAutoComplete(
  ({ hits, currentRefinement, refine }) =&gt; (
     refine(value)}
      onSuggestionsClearRequested={() =&gt; refine('')}
      getSuggestionValue={hit =&gt; hit.name}
      renderSuggestion={hit =&gt;
        hit.brand ?  : 
      }
      inputProps={{
        placeholder: 'Search for a category, brand or product',
        value: currentRefinement,
        onChange: () =&gt; {},
      }}
      renderSectionTitle={section =&gt; section.index}