Exploring ReasonML

Created July 2nd, 2018

Last updated July 26th, 2018


I take you on my journey of learning ReasonML from installation through to first application

After having dabbled in Typescript for a while my interest was piqued by ReasonML - an alternative syntax for OCaml which compiles to javascript. ReasonML brings the functional power and typesafety of OCaml to the browser (but not only!). While I am still not convinced it will fully replace javascript it definitely provides another solid alternative - especially those looking for a strongly typed language to build web applications. I am writing this post as I learn more about Reason React - first step is getting it installed. I am using Windows which turns out to be the most tricky but rest assured that everything works just find and if you aren't using Windows it is even easier!

Getting ReasonML installed.

Install the reason-cli

    npm install -g reason-cli@3.2.0-linux

Install the bucklescript platform

    npm i -g bs-platform

Create react app for Reason

    create-react-app reasontest --scripts-version reason-scripts

As we have installed bs-platform globally we need to link for our project

  npm link bs-platform

I am using VSCode which has a ReasonML extension. If you are using WSL (if you aren't it is worth checking out!) you can follow the explanations here to help get started. Make sure your shell is bash (I was using zsh and the VSCode commands were breaking)

Open up your reasontest application in VSCode. You should see something like this


You should now have autocompletion and error highlighting in your .re files.

Run your create-react-app

  npm start

If bsb was installed correctly you should see the ReasonML create-react-app page at localhost:3000

Next - Basics of ReasonML


Web development enthusiast with a keen interest in anything frontend.