ReactPlayground: JSX 3 -> JSX 4?

Are there any current plans to upgrade ReScript Playground from JSX3 to JSX4 ?

I am trying to build on the code from GitHub - rescript-association/ Official documentation website for the ReScript programming language but the problem is that it only buildson Jsx3, and not on Jsx4 (in bsconfig.json).


Are you asking to set the default jsx setting to be jsx 4? We didn’t do that for now bc it would be a breaking change for the playground bundle api.

When selecting the newest compiler in the rescript-lang .org playground, the initial example will come w/ a module pragma like this:

@@jsxConfig({ version: 4, mode: "automatic" })

For the playground in particular this is the better approach to give the user more configurability on a per-file basis.

If you are building your own custom bundle, you’d need to find the global configuration module that sets the JSX mode in the jscomp/ folder and modify the playground jsoo file to set the configuration flag on initialization.

Perhaps the question is why the website’s source code is on JSX 3 and not JSX4. (Or perhaps this is just another question).
It should be easy to switch, assuming updating react to 18 has no consequences (nextjs and whatnot).

We are not in a hurry upgrading the playground UI to JSX v4. I guess it will eventually be upgraded when migrating to the newest Next version.

I apologize for not being clear. I am hacking on the ReactPlayground code itself. In particular, I am adding a “file-tree” to the left hand side of the CodeMirror editor, so it looks like an IDE.

Now, I’d prefer to do everything using latest JSX, but when I modify bsconfig.json from JSX3 to JSX4 for the existing ReactPlayground, it fails to compile.

I am wondering if there were any plans to update this in the near future.

It was a bit implicit above: but JSX4 requires latest rescript-react, which in turn requires react 18.

Completely serious, I don’t understand why this is a problem.

JSX4 requires latest rescript-react.
Latest rescript-react requires react 18.

However, the examples on the Rescript lang website for section “Rescript & React” all appear to use JSX4 – Introduction | React – so why is React 18 a problem ?

Oh, is the problem latest Next does not support React 18, so if I want JSX4, I need to rip out the code that depends on Next ? (I think I already that by accident, it was pulling in some bloom-filter / crypto code I could not add, so I ripped out Next already).

Exactly. Newer NextJS versions support React 18, so you’d just need to upgrade to the latest NextJS version and then use the latest rescript-react bindings.