Skip to content

Get refinedFacetsCount in Panel header (eg RefinementList) #5285

Answered by Haroenv
timkelty asked this question in Q&A
Discussion options

You must be logged in to vote

Here's how to do that: https://codesandbox.io/s/young-sunset-g1vuz

Basically it's all the logic for panel normally, but changed so that instead of tracking canRefine, it tracks "count" (which is the number of isRefined true in items, it will be different per widget). Then you need to change the refinementlist widget just slightly, so that it uses the custom panel we just made

custom panel code
import React, { Component, createContext } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { createClassNames } from 'react-instantsearch-dom';

const cx = createClassNames('Panel');

const { Consumer: PanelConsumer, Provider: PanelProvider } = createCo…

Replies: 0 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by dhayab
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Library: React InstantSearch < 7 Issues in any of the react-instantsearch@6 packages
2 participants