Aglolia Refinement List With Titles - Empty Refinement Lists

export const AlgoliaRefinement = () => {
  const { attributesToRender } = useDynamicWidgets();
  return (
    <>
      {attributesToRender.map((attribute) => {
        return (
          <>
            <div className="Title">{attribute}</div>
            <RefinementList attribute={attribute} />
          </>
        );
      })}
    </>
  );
};

We have facets to display on certain pages, I would like to create a title for each refinementList container however attributes to render always returns the big array of all facets meaning there are some titles which show up without any values like the image below:
image
How can I conditionally render this component based on whether there are values in refinementlist or not? Am planning to eventually make this into a collapsible component. Thankyou