Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-instantsearch-core

Package Overview
Dependencies
Maintainers
5
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-instantsearch-core

⚡ Lightning-fast search for React, by Algolia

  • 7.13.8
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created

What is react-instantsearch-core?

react-instantsearch-core is a library that provides a set of React components and connectors to build search interfaces using Algolia's search engine. It allows developers to create highly customizable and performant search experiences in their React applications.

What are react-instantsearch-core's main functionalities?

SearchBox

The SearchBox component provides a search input field that users can type into to perform searches. It is a core component for capturing user queries.

import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-core';

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

Hits

The Hits component is used to display the search results. You can customize how each hit (search result) is rendered by providing a custom hitComponent.

import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-core';

const Hit = ({ hit }) => (
  <div>
    <h2>{hit.title}</h2>
    <p>{hit.description}</p>
  </div>
);

const App = () => (
  <InstantSearch
    indexName="your_index_name"
    searchClient={algoliaClient}
  >
    <SearchBox />
    <Hits hitComponent={Hit} />
  </InstantSearch>
);

RefinementList

The RefinementList component allows users to filter search results based on specific attributes, such as categories. It provides a list of checkboxes for users to refine their search.

import { InstantSearch, SearchBox, Hits, RefinementList } from 'react-instantsearch-core';

const App = () => (
  <InstantSearch
    indexName="your_index_name"
    searchClient={algoliaClient}
  >
    <SearchBox />
    <RefinementList attribute="categories" />
    <Hits />
  </InstantSearch>
);

Pagination

The Pagination component provides pagination controls to navigate through search results. It is useful for handling large sets of search results by breaking them into pages.

import { InstantSearch, SearchBox, Hits, Pagination } from 'react-instantsearch-core';

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

Other packages similar to react-instantsearch-core

Keywords

FAQs

Package last updated on 14 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc