babel-plugin-html-attributes-to-jsx
v1.6.22
Published
Coerce HTML attributes into something JSX and React friendly
Downloads
172
Readme
babel-plugin-html-attributes-to-jsx
Coerce HTML attributes into something JSX and React friendly. Used by MDX.
Installation
yarn add babel-plugin-html-attributes-to-jsx
Usage
const babel = require('@babel/core')
const plugin = require('babel-plugin-html-attributes-to-jsx')
const jsx = `
export const Foo = () => (
<div srcset="foo">
<Button />
</div>
)
`
const plugin = new BabelPluginHtmlAttributesToJsx()
const result = babel.transform(jsx, {
configFile: false,
plugins: ['@babel/plugin-syntax-jsx', plugin]
})
console.log(result.code)
Input
export const Foo = () => (
<div srcset="foo">
<Button />
</div>
)
Output
const Foo = () => (
<div srcSet="foo">
<Button />
</div>
)
License
MIT