Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

JSX V4 WIP #517

Closed
wants to merge 25 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
spec: clean up file
  • Loading branch information
cristianoc authored and mununki committed Jun 13, 2022
commit ee98a9f4eeedb076476b2772b48bc96e7eed5dec
18 changes: 10 additions & 8 deletions cli/JSXV4.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
**Abbreviation**
Tha placement of `@react.component` is an abbreviation as described below.

**_Normal Case_**
The placement of `@react.component` is an abbreviation as described below.

**Normal Case**

```rescript
@react.component
Expand All @@ -12,7 +13,7 @@ let make = (~x, ~y, ~z) => body
let make = @react.component (~x, ~y, ~z) => body
```

**_Forward Ref_**
**Forward Ref**

```rescript
@react.component
Expand All @@ -31,10 +32,11 @@ let make = React.forwardRef({
```

**Conversion**

Conversion applies to an arrow function definition where all the arguments are labelled.
It produces a type definition and a new function.

**_Definition_**
**Definition**

```rescript
@react.component (~x, ~y=3+x, ?z) => body
Expand All @@ -52,7 +54,7 @@ type props<'x, 'y, 'z> = {x: 'x, @optional y: 'y, @optional z: 'z, @optional key
}
```

**_Application_**
**Application**

```rescript
<Comp x>
Expand All @@ -68,7 +70,7 @@ React.createElement(Comp.make, {x, y:7, @optional z})
React.createElement(Comp.make, {x, key: "7"})
```

**_Interface_**
**Interface**

```rescript
@react.component
Expand All @@ -81,7 +83,7 @@ type props<'x, 'y, 'z> = {x: 'x, @optional y: 'y, @optional z: 'z}
let make: (props<int, int, int>) => React.element
```

**_Component_Name_**
**Component Name**

Use the V3 convention for names, and make sure the generated
function has the name of the enclosing module/file.
function has the name of the enclosing module/file.