package html_of_jsx

  1. Overview
  2. Docs

Module JSX.DebugSource

Sourcetype html_element := element

Used to inspect and re-construct the JSX element, only useful for

Sourcetype element =
  1. | Null
  2. | String of string
  3. | Unsafe of string
  4. | Node of {
    1. tag : string;
    2. attributes : attribute list;
    3. children : element list;
    }
  5. | List of element list

A function to inspect a JSX.element.

This function allows you to convert a JSX.element to its debuggable representation, which can be helpful for inspecting and debugging the structure of the element.

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

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