Trouble creating InstantSearch bindings

I’m playing around with MeiliSearch (react) which uses InstantSearch as a client.

This is the example I’m using as reference: Link to example
This is code in ReScript that shows the issue: Link to Playground

I cannot seem to understand how to translate the anonymous function that takes the hit prop and returns the hitComponent, in the example. Probably because I don’t understand what’s happening with the const Hit = ... Any clues?

The const Hit is just a function that takes hitProps and returns a React.element, so you only need to adapt the signature of the hitComponent parameter:

module Hits = {
  type hitProps

  @module("react-instantsearch-dom") @react.component
  external make: (~hitComponent: hitProps => React.element) => React.element = "Hits"
}
2 Likes

Ah, I get it now. I never type-annotated a binding to a function before. I learnt a little more now, so thank you :smile: