Skip to main content

React Autocomplete

Embark on a journey to enhance your React project's search capabilities with the empowering "hs-autocomplete-react" package. This versatile tool seamlessly integrates an advanced autocomplete feature into your application, providing an enriched user experience.

autocomplete

Instructions:

  1. To enhance your React project with advanced search capabilities, start by installing "hs-autocomplete-react." For comprehensive details, visit npmjs.com/package/hs-autocomplete-react.

    npm i hs-autocomplete-react
  2. Incorporate the HSAutocomplete component into your project by adding this import statement:

    import HSAutocomplete from 'hs-autocomplete-react'
  3. Seamlessly integrate the component into your project as demonstrated below:

    <HSAutocomplete 
    indexId={"Your indexId"}
    apiKey={"Your API key"}
    displayField={'name'}
    />
  4. Locating Essential Information: To configure the connector effectively, follow these steps:

    1. Visit to /indices page(https://hoppysearch.com/indices) and select the index on which you want to apply connector.

    2. IndexID:

      1. Retrieve your unique index ID from your index endpoint. For instance, if your index endpoint is (https://unm8df.hoppysearch.com) your index ID is "unm8df."
      2. indexId
    3. API Key:

      1. Access your API key in the "Access Management" -> "API Keys" section.
      2. indexId
    4. Display Field:

      1. Tailor the display field to match your dataset. For example, if your dataset is structured like below, customize the displayField attribute to align with your dataset, e.g., displayField=name.
      [   
      {
      "image": "https://i0.wp.com/onewholesomemeal.com/wp-content/uploads/2020/03/Aaloo-Posto-1.jpg?fit=864%2C1080&ssl=1",
      "name": "Aloo posto",
      "about": "Aloo posto is a classic Bengali dish made by cooking potatoes with poppy seeds and mustard oil...",
      "ingredients": "Potatoes, poppy seeds, mustard oil, green chilies",
      "state": "West Bengal",
      "hs_guid": "2da1eb0f-fc84-4a21-b472-56121f8e6767",
      "url": "https://www.betterbutter.in/recipe/9916/aloo-jhinge-posto%22
      }
      ]

With these user-friendly steps, you can effortlessly enhance your React project's search functionality with an autocomplete feature, elevating the overall user experience and search capabilities.

For a step-by-step visual guide on how to enhance your React project's search functionality with an autocomplete feature using "hs-autocomplete-react," watch this YouTube video.