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

Colon type in @react.component external import

$
0
0

It’s specifying the type for the “props” argument in React by inserting it after props to have it explicitly typed. It’s useful together with external, the let-bound equivalent would be:

  @react.component
  let make = (~width: int, ~height: int) => {/*...*/}

We can’t specify labeled args in that manner in FFI components, so instead we need a way to type the props argument explicitly, hence @react.component(: <type>)


Viewing all articles
Browse latest Browse all 2592

Trending Articles