Syntax Lookup
Enter some language construct you want to know more about.
@@directive / @directive
These decorators emit JavaScript directives at file or function scope.
@@directive takes a string literal payload and emits it at the very top of the generated JavaScript file, before any imports.
This is useful for directives such as 'use client' in React Server Components.
Available since ReScript 10.1.4.
File-Level Example
Since ReScript 12, @directive can also annotate a function expression. The directive is emitted at the start of the generated function:
Place the attribute after the binding's = and directly before the function. Function directives work with synchronous and asynchronous functions and with multiple or labeled parameters.