1
私はalgoliaによる反応インスタント検索を使用しており、結果が出るたびにオーバーレイを表示する必要があります。React InstantSearch:onSearchStateChange返されたヒット数を取得
私はそれをalgoliaによって提供されるonSearchStateChange関数で処理したいと思います。しかし、私はまだ全体のヒットを得るために困惑しています。私はすでにjqueryで数字を抽出することで表示される結果を使用するような非常に迅速なアイデアを持っています。しかし、私はそれをしたくありません。あなたが提案できる他の方法がありますか?
onSearchStateChange(nextState) {
//must get the number of total hits.
nextState = cleanDeep(nextState);
let filters = transformer(nextState);
this.setState({
searchState: nextState,
filters: filters,
searchChanged: true
})
this.sendToAti(filters);
this.addOverlay(); // <--- function that will show the overlay.
location.hash = qs.stringify(nextState);
}