redux-algolia
Redux middleware for Algolia Search.
Installation
- Install the package via npm
npm install redux-algolia --save
or yarn
yarn add redux-algolia
- Combine with store in
configureStore.js
Make sure you havealgoliasearch
installed
const algoliaClient = const reducer = const middlewares = // ...other middlewares, const createStoreWithMiddleware = createStore { return }
Usage
actions/search.js
const SEARCH_REQUEST = '@@algolia/SEARCH_REQUEST'const SEARCH_SUCCESS = '@@algolia/SEARCH_SUCCESS'const SEARCH_FAILURE = '@@algolia/SEARCH_FAILURE' const queryAlgolia = { return ALGOLIA: indexName: 'YOUR_ALGOLIA_INDEX_NAME' method: 'search' options: query filters requestType: SEARCH_REQUEST successType: SEARCH_SUCCESS failureType: SEARCH_FAILURE }