package server-reason-react

  1. Overview
  2. Docs
Rendering React components on the server natively

Install

Dune Dependency

Authors

Maintainers

Sources

server-reason-react-0.3.0.tbz
sha256=2a6fc7197d251dc91babcf22cb6987e1d07e91ae631cc62a893df2c6da6b49b5
sha512=c6ed6eb39b046b698844e561cf9a42a866e4df632a6e495a6473ba629ecd9ee534db0b5b42737776d9a4b15376bea1380b77749228c88a0fc0f6b10ead4b3a01

doc/index.html

server-reason-react

This is the documentation and API for server-reason-react, an implementation of react, react-dom and react-dom/server to run on the server with Reason/OCaml, with the purpose to Server-side render HTML markup from a reason-react application natively (for both SSR and SSG).

Why

Explained more about the motivation in this blog post sancho.dev/blog/server-side-rendering-react-in-ocaml and also in my talk about Server side rendering React natively with Reason at ReactAlicante 2023.

Guides

  1. Get started
  2. How universal code works
  3. How to structure the code
  4. Exclude client code from the native build
  5. Externals and melange attributes

Core API

Those are the core libraries of server-reason-react.

  • React The React library
  • reactDom

Other libraries

Aside from the core, server-reason-react exposes some needed known libraries from melange or melange-community to help make components universal:

  • Belt server-reason-react.belt (equivalent to Belt from melange)
  • Js server-reason-react.js (equivalent to Js from melange, very unsafe)
  • URL server-reason-react.url
  • Webapi server-reason-react.webapi (equivalent to Webapi from melange-webapi)

This would eventually be extracted into their own packages

Next

Get started

OCaml

Innovation. Community. Security.