useSearchResults
Use search results query hook to request and retrieve data for search results widgets. page, keyphrase, selectedFacets, itemsPerPage, and sortType.
Request parameters
| Name | Type | Description |
|---|---|---|
page | integer | The current page. |
keyphrase | string | String to search for. |
selectedFacets | array of strings | The IDs of the facets selected. |
itemsPerPage | integer | The number of results per page. |
sortType | string | The value for sorting results. |
Generic response
Import
Example
Note
Convert a UI component into a widget component before adding it to pages.
To convert a component into a widget component, pass the UI component to the widget or setWidget function.
Notice
These React resources can help you with your implementation:
-
To view working examples of widgets, visit the starter kit website built using Search JS SDK and UI components packages.
-
You can download or fork its GitHub repository.
If you have suggestions for improving this article, let us know!