Demo
Preview on CodeSandbox.
Install
npm install @algolia/react-instantsearch-widget-sortby-ul
# or
yarn add @algolia/react-instantsearch-widget-sortby-ul
Widget
Usage
import instantsearch from 'instantsearch.js';
import algoliasearch from 'algoliasearch/lite';
import { SortBy } from '@algolia/react-instantsearch-widget-sortby-ul';
const searchClient = algoliasearch('appId', 'apiKey');
const App = () => (
<InstantSearch searchClient={searchClient} indexName="indexName">
<SortBy />
</InstantSearch>
);
Connector
Usage
import { connectSortBy } from '@algolia/react-instantsearch-widget-sortby-ul';
// 1. Create a render function
const RenderSortBy = (renderOptions, isFirstRender) => {
// Rendering logic
};
// 2. Create the custom widget
const CustomSortBy = connectSortBy(RenderSortBy);
// 3. Instantiate
const App = () => (
<InstantSearch searchClient={searchClient} indexName="indexName">
<CustomSortBy />
</InstantSearch>
);
Test
npm test
# or
yarn test
Build
npm run build
# or
yarn build
Release
npm run release
# or
yarn release
First Release
npm run release -- --first-release
# or
yarn release --first-release
This will tag a release without bumping the version.
When you are ready, push the git tag and run npm publish
.
If you want to publish it as a public scoped package, run npm publish --access public
the first time.