reasonreason-react

Is it possible to use ReasonReact to build a single component?


I'm investigating the possibility to use Reason and React in an old (first commit 2003) legacy project. The approach has to be evolutionary and step-by-step. Does ReasonReact cover this use-case? Or is it mostly used to build apps from scratch?

I'm a bit surprised there's no make-like command to build a specific .re-file into a .bs.js file. Or I missed it in the docs...?


Solution

  • ReasonReact can migrate a project one file (i.e. module) at a time. Add bs-platform to your package.json's dependencies section, add a bsconfig.json file with the correct options, and add a build command (e.g. bsb -clean-world && bsb -make-world) to your build pipeline, and it will build all ReasonReact source files and produce output JS.