Skip to content

Commit 6f14e19

Browse files
zthfhammerschmidt
authored andcommitted
Blog post section on the generic JSX transform (#820)
* blog post section on the generic JSX transform * reword * changing back to Preact
1 parent a380671 commit 6f14e19

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

_blogposts/2024-02-01-release-11-1-0.mdx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,29 @@ npm install [email protected]
2020

2121
Find a list of all the new features below:
2222

23-
## Generic JSX transform
23+
## JSX for more than React
2424

25-
TODO
25+
Historically, ReScript has focused mainly on React for its frontend support. This has led to ReScript having a great JSX transform built into the language itself. However, that JSX transform has been quite difficult to use with anything but React.
26+
27+
With v11.1, that changes! The JSX transform can now be configured to work with any framework. First class React support is of course still the same, and remains a priority. This makes it possible to integrate any other framework's JSX idiomatically in ReScript. And, all the tooling like autocompletion of prop names and types just works.
28+
29+
Many popular frameworks like Vue and Preact use JSX. But, JSX is also becoming more and more ubiquitous, and these days JSX can also be used for everything from building CLI apps to responsive e-mail templating. We're happy that ReScript users will now be able to leverage all of these innovations in a more idiomatic way than before.
30+
31+
Here's an example of what a Preact integration could look like:
32+
33+
```rescript
34+
// Greet.res
35+
36+
// @jsx.component works the same as @react.component does in React
37+
@jsx.component
38+
let make = (~name) => {
39+
<div>
40+
{Preact.string("Hello " ++ name)}
41+
</div>
42+
}
43+
```
44+
45+
Read more in the [`new documentation on the generic JSX transform`](/docs/manual/latest/jsx#generic-jsx-transform-jsx-beyond-react-experimental).
2646

2747
## Tagged template literals
2848

0 commit comments

Comments
 (0)