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.1.0.tbz
sha256=557e215377660a5c48c0494704d3d149ff249d4a5669f1749b393176b963ea05
sha512=cc3dd53dd21d2564ad031ca74552587f4a8200833ec80392fd190a55d7a7f83bec0fc57d2ec0e262c0c3ef2e78a89914872ea1588921c3cb8836e8e5f67b4cef

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.