Syntax Lookup

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

The @react.component decorator is used to annotate functions that are React components.

You will need this decorator whenever you want to use a ReScript / React component in ReScript JSX expressions.

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

Example

ReScriptJS Output
@react.component
let make = (~name) => {
  <button> {React.string("Hello " ++ name ++ "!")} </button>
}

References