package html_of_jsx

  1. Overview
  2. Docs

Enable React attributes

(Experimental)

Support React properties as attributes in all HTML and SVG elements.

React properties

React properties are renamed to match the React DOM API. The rendered HTML won't have any reactisms. For example, `className` is renamed to `class`, `htmlFor` is renamed to `for`, etc.

Those react properties are additional, HTML and SVG attributes are still correct. For example, `class` is still valid, and `className` is also valid.

Why

This mode is a way help to migrate away from (or migrate to) React

Enable

Adding the -react flag into the ppx

  (libraries html_of_jsx)
  (preprocess (pps html_of_jsx.ppx -react))

Example

JSX.render(<div className="random" />);
OCaml

Innovation. Community. Security.