All Projects → jchavarri → Jsoo React

jchavarri / Jsoo React

Licence: mit
js_of_ocaml bindings for ReactJS. Based on ReasonReact.

Programming Languages

ocaml
1615 projects

Projects that are alternatives of or similar to Jsoo React

Bsdoc
📚 Documentation Generator for BuckleScript
Stars: ✭ 43 (-57.43%)
Mutual labels:  reasonml
Revery Terminal
Barebones terminal emulator built with ReasonML + Revery + libvterm
Stars: ✭ 76 (-24.75%)
Mutual labels:  reasonml
Reason Loadable
🔥 Suspense/Lazy for ReasonReact.
Stars: ✭ 88 (-12.87%)
Mutual labels:  reasonml
Recontainers
[DEPRECATED] ReasonReact utilitary high order components
Stars: ✭ 54 (-46.53%)
Mutual labels:  reasonml
Reenv
dotenv-cli implementation in native ReasonML providing near-instant startup times
Stars: ✭ 65 (-35.64%)
Mutual labels:  reasonml
Introduce Reason Example
An example app made with Create React App which introduces a Reason component
Stars: ✭ 82 (-18.81%)
Mutual labels:  reasonml
Reason From The Very Beginning
Ocaml From The Very Beginning solved with Reason instead of Ocaml
Stars: ✭ 36 (-64.36%)
Mutual labels:  reasonml
Reason React Native Web Example
Razzle + Reason-React + React-Native-Web. Damn that's a lot of R's.
Stars: ✭ 98 (-2.97%)
Mutual labels:  reasonml
Restyled
Styled Components concept for Reason React, only works with bs-react-native for now
Stars: ✭ 68 (-32.67%)
Mutual labels:  reasonml
Lenses Ppx
PPX to derive GADT lenses for ReasonML
Stars: ✭ 85 (-15.84%)
Mutual labels:  reasonml
Gitlab Search
Command line tool to search for contents in GitLab repositories
Stars: ✭ 60 (-40.59%)
Mutual labels:  reasonml
One Punch Fitness
A "One Punch Man"-inspired workout app!
Stars: ✭ 64 (-36.63%)
Mutual labels:  reasonml
Bs Glamor
BuckleScript bindings for glamor
Stars: ✭ 83 (-17.82%)
Mutual labels:  reasonml
Reason App Shell Starter Kit
A simple App Shell starter kit that you can use to get started building your PWA with ReasonML & ReasonReact.
Stars: ✭ 49 (-51.49%)
Mutual labels:  reasonml
A Reason React Tutorial
included code for A ReasonReact Tutorial
Stars: ✭ 94 (-6.93%)
Mutual labels:  reasonml
Pragma
Pragma is a self-hosted, open-source, personal note taking app.
Stars: ✭ 39 (-61.39%)
Mutual labels:  reasonml
Rescript React Update
useReducer with updates and side effects!
Stars: ✭ 79 (-21.78%)
Mutual labels:  reasonml
Reason
Simple, fast & type safe code that leverages the JavaScript & OCaml ecosystems
Stars: ✭ 9,545 (+9350.5%)
Mutual labels:  reasonml
Ppx bs css
A ppx rewriter for CSS expressions.
Stars: ✭ 98 (-2.97%)
Mutual labels:  reasonml
Timerlab
⏰ A simple and customizable timer
Stars: ✭ 84 (-16.83%)
Mutual labels:  reasonml

jsoo-react

Actions Status

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 Spin with the spin-jsoo-react template.

  1. First, install Spin following the instructions.

  2. Then run:

    spin new https://github.com/tmattio/spin-jsoo-react.git
    

    After that, check the newly created project readme to get started.

Existing project

  1. Install the jsoo-react package and gen_js_api dependency:

    opam pin add -y gen_js_api https://github.com/jchavarri/gen_js_api.git#typ_var
    opam pin add -y jsoo-react https://github.com/jchavarri/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 does not make any assumptions about how you will load React.js in your application. There are 2 ways of doing so:

    With Webpack (or any JavaScript bundler)

    If you want to use Webpack, Rollup, Parcel or any other JavaScript bundler, include a file react-requires.js in your application source folder with the following content:

    joo_global_object.React = require('react');
    joo_global_object.ReactDOM = require('react-dom');
    

    Then add it to your application dune file so it can be linked:

    (executables
    ...
    (js_of_ocaml
      (javascript_files react-requires.js)))
    

    To see an example of this approach, check the example folder.

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

    With <script> tags

    If you are not using any JavaScript bundlers, and just loading the bc.js artifact generated by Dune, you can just add the following HTML tags to your index.html page:

    <script src="https://unpkg.com/[email protected]/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/[email protected]/umd/react-dom.development.js" crossorigin></script>
    

    Make sure they are loaded before your application bc.js artifact.

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 🙌

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].