Syntax Lookup

Enter some language construct you want to know more about.
This is the @react.componentWithProps decorator.

The @react.componentWithProps decorator is used to annotate functions that are React components which take in a record type as prop. This decorator will ensure your component gets an uppercased name.

Note The @react.componentWithProps decorator requires the react-jsx or jsx config to be set in your rescript.json to enable the required React transformations.

Example

ReScriptJS Output
module Hey = {
  type props = {
    name: string,
  }

  @react.componentWithProps
  let make = (props: props) => {
    <button> {React.string("Hello " ++ props.name ++ "!")} </button>
  }
}

References