1.0.4 • Published 3 years ago

@eunjae-lee/search-box v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

search-box

This project was generated with create-instantsearch-app by Algolia.

InstantSearch widget that makes a search box

Install

npm install @eunjae-lee/search-box
# or
yarn add @eunjae-lee/search-box

Widget

Usage

import instantsearch from 'instantsearch.js';
import algoliasearch from 'algoliasearch/lite';
import { SearchBox } from '@eunjae-lee/search-box';

const searchClient = algoliasearch('appId', 'apiKey');

const App = () => (
  <InstantSearch searchClient={searchClient} indexName="indexName">
    <SearchBox />
  </InstantSearch>
);

Connector

Usage

import { connectSearchBox } from '@eunjae-lee/search-box';

// 1. Create a render function
const RenderSearchBox = (renderOptions, isFirstRender) => {
  // Rendering logic
};

// 2. Create the custom widget
const CustomSearchBox = connectSearchBox(
  RenderSearchBox
);

// 3. Instantiate
const App = () => (
  <InstantSearch searchClient={searchClient} indexName="indexName">
    <CustomSearchBox />
  </InstantSearch>
);