File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ id : " react-component-decorator"
3
+ keywords : ["react", "component", "decorator"]
4
+ name : " @react.component"
5
+ summary : " This is the `@react.component` decorator."
6
+ category : " decorators"
7
+ ---
8
+
9
+ The ` @react.component ` decorator is used to annotate functions that are [ ReasonReact] ( https://reasonml.github.io/reason-react/en/ ) components.
10
+
11
+ ### Example
12
+
13
+ <CodeTab labels = { [" ReScript" , " JS Output" ]} >
14
+
15
+ ``` res
16
+ @react.component
17
+ let make = (~name) => {
18
+ <button> {ReasonReact.string("Hello " ++ name ++ "!")} </button>
19
+ }
20
+ ```
21
+
22
+ ``` js
23
+ var React = require (" react" );
24
+
25
+ function MyComponent (Props ) {
26
+ var name = Props .name ;
27
+ return React .createElement (" button" , undefined , " Hello " + name + " !" );
28
+ }
29
+
30
+ var make = MyComponent;
31
+ ```
32
+
33
+ </CodeTab >
34
+
35
+ ### References
36
+
37
+ * [ ReasonReact Components] ( https://reasonml.github.io/reason-react/docs/en/components )
You can’t perform that action at this time.
0 commit comments