How to use the react-instantsearch/connectors.connectSortBy function in react-instantsearch

To help you get started, we’ve selected a few react-instantsearch 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 jscoach / client / src / SortBy.js View on Github external
import React from "react";
import { connectSortBy } from "react-instantsearch/connectors";

const SortBy = connectSortBy(({ items, currentRefinement, refine }) => (
  <div>
    <select value="{currentRefinement}"> {
        e.preventDefault();
        refine(e.target.value);
      }}&gt;
      {items.map(item =&gt; (
        <option value="{item.value}">
          Sort by {item.label}
        </option>
      ))}
    </select>
    <div>
      <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"></svg></div></div>
github algolia / react-instantsearch / examples / react-native / src / Home.js View on Github external
/&gt;
  );
}

Hits.propTypes = {
  hits: PropTypes.array.isRequired,
  refine: PropTypes.func.isRequired,
  hasMore: PropTypes.bool.isRequired,
};

const ConnectedHits = connectInfiniteHits(Hits);
const ConnectedStats = connectStats(({ nbHits }) =&gt; (
  
));

const ConnectedSortBy = connectSortBy(
  ({ refine, items, currentRefinement }) =&gt; {
    const icon =
      Platform.OS === 'ios' ? (
        
      ) : (