package jsoo-react

  1. Overview
  2. Docs
Bindings to ReactJS for js_of_ocaml, including JSX ppx

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.tar.gz
md5=240fd3b58cb002ff7eaa6ddddb7eba87

Description

Published: 07 Apr 2023

README

jsoo-react

Bindings to React for js_of_ocaml, including JSX ppx.

Adapted from ReasonReact.

jsoo-react allows to use React from OCaml, but it is still at the experimental phase: there is no published version in opam yet, and the library is expected to break backwards compatibility often.

Bug reports and contributions are welcome!

Getting started

New project

For new projects, the best way to start is by using the jsoo-react template.

Existing project

  1. Install the jsoo-react package:

    opam pin add -y jsoo-react https://github.com/ml-in-barcelona/jsoo-react.git
    
  2. Add jsoo-react library and ppx to dune file of your executable JavaScript app:

    (executables
    (names index)
    (modes js)
    (libraries jsoo-react.lib)
    (preprocess
      (pps jsoo-react.ppx)))
    
  3. Provision React.js library

    jsoo-react uses require to import React and ReactDOM. This means that you will likely need to use a bundler such as Webpack or rollup.js.

    Note that at this moment, jsoo-react is compatible with React 16, so be sure to have the appropriate constraints in your package.json.

Contributing

Take a look at our Contributing Guide.

Acknowledgements

Thanks to the authors and maintainers of ReasonReact, in particular @rickyvetter for his work on the v3 of the JSX ppx.

Thanks to the authors and maintainers of Js_of_ocaml, in particular @hhugo who has been answering many many questions in GitHub threads.

Thanks to the Lexifi team for creating and maintaining gen_js_api.

Thanks to @tmattio for creating Spin and the jsoo-react template :raised_hands:

And thanks to the team behind React.js! What an amazing library :)

Dependencies (5)

  1. ppxlib >= "0.23.0"
  2. gen_js_api >= "1.0.8"
  3. js_of_ocaml >= "4.0.0"
  4. ocaml >= "4.12.0" & < "5.0.0"
  5. dune >= "2.7"

Dev Dependencies (9)

  1. odoc with-doc
  2. js_of_ocaml-lwt with-test
  3. ppx_blob with-test
  4. reason = "3.8.2" & with-test
  5. ocamlformat = "0.21.0" & with-test
  6. conf-npm with-test
  7. js_of_ocaml-ppx with-test
  8. webtest-js with-test
  9. webtest with-test

Used by

None

Conflicts

None