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.2.0.tbz
sha256=f7e93b2c24e6420ed7352f5b04ff028ea6ea8b9b91679bbce43aadfcae028f34
sha512=b74f883d8fad95738b7dd9b51f23af27ef1b541939ad9b8ea65cfb0d48a217c2265ca9319e9355c7782bf223a5168ee4ff236677503afa301c8b7b08561fcd8c

doc/src/server-reason-react.runtime/Runtime.ml.html

Source file Runtime.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
exception Impossible_in_ssr of string

let fail_impossible_action_in_ssr fn =
  let backtrace = Printexc.get_callstack 8 in
  let raw_callstack = Printexc.raw_backtrace_to_string backtrace in
  let () =
    Printf.printf
      {|'%s' should only run on the client. Make sure you aren't accidentally calling this function in a server-side context.

Here's the raw callstack:

%s
|}
      fn raw_callstack
  in
  raise
    (Impossible_in_ssr (Printf.sprintf {|'%s' shouldn't run on the server|} fn))

type platform = Server | Client
OCaml

Innovation. Community. Security.