Under the hood, the component calls the
setState function (from the
useState() Hook) to update the render state of the widget whenever the widget render state parameters changes, so state change triggers a re-render in React.
This allows the first set of
results to be artificial (
__isArtificial: true), so you can rely on the
results without any conditions on the variable being defined or not on first render. The second set of
results is populated with the actual
results from the API.
Here is the implementation in React InstantSearch Hooks.
Article is closed for comments.