Rescript + react native experiences?

Hi everyone!

I am used to using Elm and Typescript+node for creating my applications. However, recently I wanted to start using Typescript + react native and even though I have strict mode, I just keep running into runtime errors over and over again. It’s not a very nice experience at all.

So now I’m looking for something else. Rescript seems to be promising better guarantees than Typescript, so I’m wondering what people’s experience are developing React Native apps. Is the interop easy enough? Do you still run into runtime errors?

1 Like

I can’t say I have tried it with React Native, but in general, I find that Rescript slots in seamlessly with standard Javascript ecosystems, where Typescript tends to want to “take over” the Javascript build pipelines, leading to a lot of headaches.

It is suggested to compile your rescript code right alongside the Javascript files. This means that the react-native build pipeline doesn’t even need to know you’re using Rescript. So long as Rescript compiles to standard JS that React-native can understand, it should be a seamless experience.

I’d also note that the JS Rescript spits out is easily hand-readable. If you start your project in Rescript and decide Rescript isn’t for you, you will find it fairly straightforward to port the Rescript code to standard JS.

The one caveat with all this is that Rescript does have a standard library and there is a chance it won’t cooperate with React-native (though I doubt it). It’s also possible to craft Rescript that doesn’t bring in the stdlib, but I don’t have any experience with this and suspect it’s a bit of a pain.

1 Like

We built a pretty complete app in ReScript (I work full time on it), and the experience has been great with ReScript and reason-react-native!

Especially with rescript-apollo-client (typesafe GraphQL client). We rarely have runtime errors. (And we had quite a lot of issues with TypeScript before we converted.) The best thing is I can now fearlessly make big refactors.

7 Likes

MealsUp is about 20% Flow typed JS and 80% Reason/ReScript, and although this may sound like exaggeration, it’s not: the only runtime errors I’ve had in 4 years of production, according to my error tracking service, have been from the Flow parts.

2 Likes

Your app looks great @benadamstyles. Let me also put in a app store link to our app: Family5

3 Likes