package html_of_jsx
All checked builds pass
Render HTML with JSX
Install
dune-project
Dependency
Authors
Maintainers
Sources
html_of_jsx-0.1.2.tbz
sha256=f85c0cb84cf89300869a1da5b896591c6950c50925d20e560d677e8ed3f0f940
sha512=2bd6c7bdfc49914833eadbeef78cb581f3166269861a14baea5e7e1eaa1cbaa1f78defda9d30f5817c1a1b5cec255386d990d4fd7264cc3e3976e6e657144460
doc/React-compatibility.html
React compatibility mode
The React compatibility mode eases migration from reason-react to html_of_jsx. It adds camelCase aliases for HTML attributes that React uses instead of the standard HTML names.
Enable
Turn on -react in your ppx configuration.
(libraries html_of_jsx)
(preprocess (pps html_of_jsx.ppx -react))Aliases
The -react flag adds the following aliases. The standard HTML attribute names still work.
React name | HTML output | Type |
|---|---|---|
|
| string |
|
| string |
|
| int |
|
| int |
|
| bool |
|
| int |
|
| int |
|
| string |
|
| string |
|
| bool |
JSX.render(
<div className="card">
<label htmlFor="email"> {JSX.string("Email")} </label>
<input
id="email"
type_=`email
tabIndex=1
maxLength=100
autoComplete="email"
readOnly=true
/>
<table>
<tr> <td colSpan=2> {JSX.string("Full width")} </td> </tr>
</table>
</div>
)JSX.render (
<div className="card">
<label htmlFor="email"> (JSX.string "Email") </label>
<input
id="email"
type_=`email
tabIndex=1
maxLength=100
autoComplete="email"
readOnly=true
/>
<table>
<tr> <td colSpan=2> (JSX.string "Full width") </td> </tr>
</table>
</div>
)