Opinion related to ReasonML and coming from React

As I was looking into incorporating React into my application and looking at examples on the web, ReasonML kept coming up and I was hoping to get some advice.

Questions:

1 - If you came from React. Why did you/your team decide to make the switch?
2 - Are there a lot of packages we can import much similar to React (JS)?
3 - Was there a deep learning curve with switching?
4 - Are there any performance benefits using ReasonML vs React?

Thank you for all your opinion in regards to this topic.

I have been trying ReasonML for some time, mostly because I wanted to have a look at OCAML.

As I have been reading Domain Modeling Made Functional which cover F#, it was easy to start with ReasonML.

And You can see benefits on the spot… no need for Redux, ReactRouter, Babel or Webpack. You can use functor to create your own router and state management. Bucklescript is blazing fast.

Like ELM, if it compiles it’s good to go.

Unlike ELM, You can use any libraries, but You will need to learn FFI, and that was really painful. For example, I had to write bindings for Phoenix.js. I am not sure it is even possible with latest version of ELM. Thankfully there was a previous work from @yawaramin for Phoenix.js 1.2 here

React 16.8 introduces hooks, it’s now possible to use only functional components. It’s not clear if the switch is worth for now. Maybe because I feel confident when writing plain JS.

One advantage I can see is it has the potential to compile to native code. That would be the killer advantage :slight_smile:

  1. to be functional on the front end
  2. all, but You need to create bindings if they do not exists (that might be painful)
  3. well, it depends, for me it was a nice learning experiment. You might be switching a lot between docs of OCAML, Bucklescript, ReasonML. ReasonML is also trying too much to make Bucklescript looks like JS (as a marketing purpose I guess). I would prefer to have only one syntax.
  4. in the end, You just compile to JS in both case. But Bucklescript transpiler is really fast and You get type safety checking at compile time.

I have decided not to use it for the moment, and use React hooks, while still keeping an eye on it. But I might change opinion when ReasonML will compile to native code.

5 Likes