Rescript with legacy React? (React 15)

Hey there - sorry if this is a stupid question but I’m looking for more information regarding how I might integrate Rescript into a codebase that uses a legacy version of React. I’ve noticed that the old ReasonReact seems to support the old React api, but I’m not sure how to determine which versions of Rescript/ReasonReact are compatible with class components, or even whether it would instead be better to simply use the latest Rescript and somehow roll my own bindings to the React class component api (I’m sure you can tell I’m a total novice by now.)

Any help is very appreciated!

TLDR; What are my best options for using Rescript in a legacy (React 15) codebase?

The very best approach would be to upgrade your existing React 15 codebase to v16 (which in most parts should be easily usable with old legacy codebases afaik, so you don’t have to touch any existing code at all?) and write new components with the new function components api.

It should be possible to write externals to existing class-based components in ReScript, but it’s not possible to write class-based components in ReScript itself. We don’t recommend using the legacy ReasonReact apis due to the lack of community support, and also because the api itself was pretty complex.

1 Like