package html_of_jsx

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Provides ways to inspect a JSX.element.

type __node = {
  1. tag : string;
  2. attributes : Attribute.t list;
  3. children : __element list;
}

Type for inspection of a node

and __element =
  1. | Null
  2. | String of string
  3. | Unsafe of string
  4. | Fragment of __element list
  5. | Node of __node
  6. | Component of unit -> __element
  7. | List of __element list
val view : element -> __element

A function to inspect a JSX.element.

let debug: JSX.Debug.__element =
  JSX.Debug.view(
    <div>
      <h1> {JSX.string("Hello, World!")} </h1>
    </div>
  );

switch (debug) {
  | JSX.Debug.Node {tag; attributes; children} -> Printf.printf("Node: %s", tag)
  | _ -> ()
}
OCaml

Innovation. Community. Security.