Here are some reflections on my path to creating a first ReasonReact application.
ReasonReact is still React
You can use your previous knowledge of building React applications. However, ReasonReact ships with the underlying assumptions of React and React hooks: one-way data binding, handling derived state or synchronizing state, the complexities of life-cycle management, useEffect, etc.
If you're only used to dynamically typed languages, then the learning curve is hard. If you're used to working in an object-oriented-fashion, then it's hard, too.
OCaml is a functional programming language that is strongly statically typed.
It also takes a while to get the hang of the type system and you will encounter a lot of type errors at first.
The compiler errors might be friendly but can still seem cryptic to a beginner.
The documentation is sorely lacking.
First, it's spread across different resources: the ReasonML docs, the BuckleScript docs, the OCaml docs.
Some of the documentation gives a hint of the type signature, some sparse explanation, but no examples. That's not beginner-friendly.
Another example: there are several container types you can use. Let's take an array, for example. There is the ReasonML Array, but also a BuckleScript Array type - and a native JS Array, too.
Working with ReasonReact is quite frustrating. There are not even examples for all the hooks. I can understand that the developers reference the React documentation for hooks for the underlying principles. But you don't get code examples for how the syntax works with ReasonReact.
When I tried to use
useRef, I had to search the forums, GitHub, etc., to get an example.
There is a recent initiative to improve documentation, so I hope that the situation will improve.
The community on Discord is extremely welcoming and active. Every time I posted a problem or asked for, I got help shortly afterward (mostly within the hour).
The tone is friendly.
With Vim, you'll get adequate editor support via language server plugin.
I haven't understood how that works yet and got away with googling so far.
ReasonML is fun
After the initial hurdle, I quite enjoy ReasonML.
Pattern-matching and variant types are such powerful language features that make development such a joy.
Creating a mental model by defining types helps reason about a program.
The compiler is blazingly fast, and type inference works like magic.
ReasonML feels like TypeScript on steroids: better type system, faster, with immutable data structures - but much harder to learn.