Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

How to use Custom Components as Props in rescript

$
0
0

Like Paul is saying, if you’re putting the CustomDot in brackets as you are passing it into Carousel, you are doing the rendering of that component into React.element. You don’t pass the props to CustomDot there in your example so its unclear which way you want that to go.
If its the Carousel that applies onMove, index etc to CustomDot, you would say like…

module CustomDot = {
type props = {
  onClick: () => ()
}

let make = (props: props) => {
  React.null
  }
}

module Carousel = {
@react.component
  external make : (~customDot: CustomDot.props => React.element) => React.element = "Carousel"

}

<Carousel customDot=CustomDot.make/>

Viewing all articles
Browse latest Browse all 2592

Trending Articles