Skip to content

Commit 252dae4

Browse files
authored
Fix example in elements-and-jsx.mdx
1 parent 4818367 commit 252dae4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pages/docs/react/latest/elements-and-jsx.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ let wrapChildren = (children: React.element) => {
3434
</div>
3535
}
3636
37-
wrapChildren(<div> React.string("Let's use React with ReScript") </div>)
37+
wrapChildren(<div> {React.string("Let's use React with ReScript")} </div>)
3838
```
3939

4040
Understanding the definition of a `React.element` is essential since it is heavily used within the React APIs, such as `ReactDOM.render(element, ...)`, etc. Be aware that JSX doesn't do any automatic `string` to `React.element` conversion for you (ReScript forces explicit type conversion). For example `<div> Hello World </div>` will not type-check (which is actually a good thing because it's also a huge source for subtle bugs!), you need to convert your `"Hello World"` with the `React.string` function first.

0 commit comments

Comments
 (0)