yarn add @searchkit/client
The SearchkitClient class encapsulates Searchkit's core client-side API. Maintains query and filter state and performs an apollo query
Will perform a request to API with the current query, page and filters currently in state
To set the query. When called, will reset pagination and filters applied
|query||The query value|
Returns the current query that has been set
Sets the current page
|page||PageOptions is an object which has |
Returns an array of filters currently in state
Returns true when there has been a query or filter applied to the search
Returns true if the filter has been applied to the search.
Returns all filters that match id. If no filters have been found, will return null
Removes filter from applied filters
Removes all filters from applied filters that match id
Adds filter to applied filters
If the filter already exists in applied filters then it will remove the filter. If doesn't exist, will add the filter
Set sorting id. Sort field is returned in the query variables
Wraps component with Searchkit Provider with an instantiated SearchkitClient. Useful for NextJS Pages.
Wraps component with Searchkit Routing functionality. Requires NextJS Page. See url synchronization for more information.
Provides to child components access to the shared SearchkitClient instance
client: Required. Instance of SearchkitClient to be used by child components which need SearchkitClient API
Returns the shared SearchkitClient instance. Required to update the shared query / filter state and for components to invoke a new query.
Hook that returns all searchkit variables needed to power the search. Use in conjuction with apollo client.
Hook thats similar to the react useState hook but listens on changes to SearchkitClient and updates the value should there be a change in value outside of the component (like url query change).
A link component that handles the interaction for toggling a filter. If routing has been configured, (see routing guide for more information) href attribute would be provided for the next state.
|filter||Required. Filter object to be toggled. If filter is selected, the next action will be for it to be removed|
|resetPagination||Optional. Default is true. When true, when filter is applied, resets pagination to 0.|
A link component that handles the interaction for navigating to a particular page. If routing has been configured, (see routing guide for more information) href attribute would be provided for the next state.
|page||Required. The next page|