How to use it
- 1Paste your HTML or drop a file onto the input panel.
- 2Adjust the options — the result updates as you type.
- 3Copy the JSX or download it. Drop several files to convert a batch into one ZIP.
What is rewritten
class becomes className, for becomes htmlFor, and attributes such as tabindex, maxlength and colspan are camelCased. SVG attributes are handled too: stroke-width becomes strokeWidth, xlink:href becomes xlinkHref. data-* and aria-* attributes are left alone, as React expects.
Inline style strings become style objects with camelCased properties. Void elements such as <img>, <input> and <br> are self-closed. Comments become JSX comments, and literal braces in text are escaped.
Inline event handlers can't be translated mechanically — onclick="track('checkout')" refers to a global function — so each becomes an empty arrow function with the original code in a comment.
Questions
Does it work for SVG icons?
Yes. Paste the SVG and you get a component with camelCased attributes. Replace hard-coded fill and stroke colours with currentColor if you want the icon to inherit text colour.
What about several root elements?
They are wrapped in a fragment (<>…</>), since a component must return a single root.