Menu

A free HTML to React (JSX) converter that runs in your browser
📰

A free HTML to React (JSX) converter that runs in your browser

DEV Community: react·Danial·about 3 hours ago
#49RdcPb0
#devtoreact#devto#dev#react#html
Long article (419 words) — no AI summary yet.
Reading 0:00
15s threshold

Danial

Posted on Nov 20

Edited on Nov 20

I made a small tool: paste HTML, get React JSX or a typed component. It's free, needs no signup, and runs in your browser. The link is at the end.

The problem

HTML and JSX look alike, but they differ in small, annoying ways. class has to become className , for becomes htmlFor , inline style="..." strings must turn into objects, and void tags like <img> and <input> must be self-closing. When you paste a big chunk of markup from a template, a design export or an old page, fixing all of this by hand is slow and easy to get wrong.

What the converter does

Converts attributes to their JSX names ( class to className , for to htmlFor )

Turns inline style strings into style objects with camelCase properties ( background-color becomes backgroundColor )

Self-closes void elements

Converts hyphenated SVG attributes to camelCase ( viewBox , strokeWidth )

Can wrap the result in an exported component, with TypeScript typing ( React.FC )

Example

Input:

<div class =…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.