我正在尝试在React组件中使用Web组件(paper-icon-button),我收到以下错误:
Error: Lower case component names (paper-button) are no longer supported in JSX" error: See http://fb.me/react-jsx-lower-case
从React 0.12开始,所有小写标签名称都被解释为DOM元素与React组件,因此这应该有效:
<paper-icon-button className="red" icon="favorite"></paper-icon-button>
但是,我注意到/node_modules/react/dist/JSXTransformer.js
和/node_modules/react-tools/vendor/fbtransform/transforms/react.js
的当前版本仍然包含以下条件:
// Identifiers with lower case or hypthens are fallback tags (strings).
// XJSMemberExpressions are not.
if (nameObject.type === Syntax.XJSIdentifier && isTagName(nameObject.name)) {
// This is a temporary error message to assist upgrades
if (!FALLBACK_TAGS.hasOwnProperty(nameObject.name)) {
throw new Error(
'Lower case component names (' + nameObject.name + ') are no longer ' +
'supported in JSX: See http://fb.me/react-jsx-lower-case'
);
}
此评论// This is a temporary error message to assist upgrades
似乎表明这只是一条信息性消息,但它打破了我的应用程序的Grunt工作流程。如何使用react@^0.12?
我的项目:
使用options: { transform: [require('grunt-react').browserify] }
选项运行grunt-browerify任务时收到错误。这就是我在package.json中的内容:
...
"grunt-browserify": "^3.3.0",
"grunt-react": "^0.10.0",
"react": "^0.12.2",
"node-jsx": "^0.12.4"
...