package html_of_jsx
Render HTML with JSX
Install
dune-project
Dependency
Authors
Maintainers
Sources
html_of_jsx-0.0.9.tbz
sha256=edc7d6d604820ef20d76611eaf7fdc29c691dd9fb48ed9930900f7f331dfea02
sha512=35eead27322cc1d3b34e32ed964449ff83a75f74f01c1127d54504145192b9c7726820f4825f5c793bde0887df202e4769946782d4f42c40b3a5a609daa4aada
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>
)