HTML转JSX工具
将HTML即时转换为React JSX。自动将class转为className,将内联样式转为对象,并为void元素添加自闭合标签。
0 字符
0 字符
使用方法
将HTML即时转换为React JSX。自动将class转为className,将内联样式转为对象,并为void元素添加自闭合标签。
- 1Paste your HTML code into the left input panel.
- 2The JSX output appears automatically in the right panel.
- 3Review the converted JSX — check className, htmlFor, and event handlers.
- 4Click Copy to copy the JSX to your clipboard.
- 5Use the Paste Example button to see a demo conversion.
主要功能
- Converts class → className and for → htmlFor automatically
- Transforms inline style strings into JavaScript style objects
- Self-closes void elements: <img />, <input />, <br />, <hr />
- Converts HTML comments to JSX {/* comment */} syntax
- camelCases all HTML event attributes (onclick → onClick)