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?
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.
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.
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.
I remember reading that Facebook uses reasonml for Messenger. Have they transitioned to rescript? And if so, do they use rescript for their native app?
the only runtime errors I’ve had in 4 years of production, according to my error tracking service, have been from the Flow parts.
Sorry to be off-topic but: you’ve been running Reason/ReScript for 4 years?
I remember reading that Facebook uses reasonml for Messenger. Have they transitioned to rescript?
We’ve restarted transitioning right now actually; we’ve transitioned enough files in the past to know that the conversion works, but we’ve then put it on lower priority (since we know the teams and they wouldn’t have minded the hybrid state as much as open source folks would have).
I’ve done a whole multiplayer game in ReasonML/ReScript and React Native, the server part is in ReScript too. I can say, that the language is the strongest tier in the whole stack. More details of how it was is in the article.
For a year, we have been developing with React Native and ReasonML a B2B application for retailers (stock management, accounting, billing …). The development experience is very pleasant. Bugs are almost non-existent.
In the past we had developed a version with React Native and Flow and we had many bugs. With ReasonML everything is easier now.
We are migrating from ReasonML to ReScript this month. Everything is going very well.
Our React Native application is for iPad (react-native for iOS) and Web (react-native-web).
Our team of two has been developing a quite complete React Native app for scheduling shifts work in ReasonML (and then migrated to Rescript/GraphQL). You could take a look here: (CameloHQ).
In the beginning, we have actually considered 50/50 between Typescript and Rescript and I’m happy that we had made the right choice.
With Rescript, once you are done with the code, you gonna sleep well at night
Slightly off-topic because we’re actually not using react-native. But still:
We are successfully running customer application(s) for 3 years in production, without any of the common js runtime errors. The very few bugs we had were in the actual business logic and easily tested and fixed.
We are using 100% reasonml (with previous buckescript) to provide a framework for complex serverless, event-sourced business-applications in the cloud (using infrastructure-as-code besides other things).
React & graphql based frontend is built using rescript as well.
We will start transitioning to latest rescript version this month.
I strongly believe that many of the things we achieved wouldn’t have been possible with just pure js or ts. We are a small team of 3-4 devs. (2 core framework maintainers, which I am one of). The language enabled us to securely do large refactorings, reduce time to market and operational costs without being completely stressed out about possible hidden bugs. Possibilities of “meta-programming” helped us further to build our abstractions and improve reusability.
P.S: I’m afraid our framework is still closed source, but I’ll happily discuss in more detail in a separate thread. Open sourcing our work is still hard to do at my company, while I’m still trying to push the idea further.
Edit: like @dusty-phillips said, integration with js is great and I only heard good things about using rescript together with react-native. Maybe @MoOx has more insights, as he maintians the rescript bindings as far as I know.