Babel plugin that transforms HTML and SVG attributes on JSX host elements into React-compatible DOM property names, numeric values, and boolean handling. Version 3.0.5 is current stable; it only transforms host elements (lowercase tag names) since v3 breaking change. Key differentiator: allows copying HTML/SVG verbatim into React components without manual attribute renaming. Alternatives like babel-plugin-html-attributes have narrower coverage or different API.
npm install babel-plugin-react-html-attrsVerified import paths — ran on the pinned version, not inferred.
Shows Babel configuration (short plugin name) and programmatic API usage with TypeScript.
If you need transformation on custom components, stick with v2.x (babel-plugin-react-html-attrs@2).
Use v1.x with Babel 5, or upgrade to Babel 6+ and v2+.
Use import statement instead of require.
Ensure plugins order: ["react-html-attrs", "transform-react-inline-elements"]
Add to Babel config: "presets": [["@babel/preset-react", { "throwIfNamespace": false }]]Upgrade Node to version 6 or higher.
Upgrade to babel-plugin-react-html-attrs@3.0.5 or later.
Set @babel/preset-react option throwIfNamespace to false.
Use import reactHtmlAttrs from 'babel-plugin-react-html-attrs' or set type: 'commonjs' in package.json.
No dependency data recorded yet.