Array of facets
Loading state
import { useFacets } from '@nosto/preact'
import { defaultConfig } from "../config"
export default () => {
const { loading, facets } = useFacets()
return (
<div style={loading ? "opacity: 0.3;" : ""}>
<div>
<ul>
{facets.map(facet => {
switch (facet.type) {
case "terms":
return <Facet facet={facet} />
case "stats":
return <RangeFacet facet={facet} />
default:
return null
}
})}
</ul>
</div>
</div>
)
}
Preact hook that import facets to the component.