美文网首页
React 插件:babel-plugin-react-html

React 插件:babel-plugin-react-html

作者: 与蟒唯舞 | 来源:发表于2017-10-18 15:54 被阅读203次

Transforms JSX class attributes into className and for attributes into htmlFor, allowing you to copy and paste HTML into your React components without having to manually edit these particular attributes each time.

Installation & Usage

Install the plugin:

# For Babel 6
npm install --save-dev babel-plugin-react-html-attrs

# For Babel 5
npm install --save-dev babel-plugin-react-html-attrs@1.0.0

Then edit your .babelrc to include react-html-attrs:

{
  "plugins": [
    "react-html-attrs"
  ]
}

相关文章

网友评论

      本文标题:React 插件:babel-plugin-react-html

      本文链接:https://www.haomeiwen.com/subject/cnkeuxtx.html