fix react inline elements plugin when creating properties out of jsx expression containers - fixes #2766

This commit is contained in:
Sebastian McKenzie 2015-11-03 03:34:46 +00:00
parent c1cceef128
commit 91c463c0f7
3 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,5 @@
var TestComponent = React.createClass({
render: function () {
return <span className={this.props.someProp} />;
}
});

View File

@ -0,0 +1,14 @@
var TestComponent = React.createClass({
render: function () {
return {
$$typeof: babelHelpers.typeofReactElement,
type: "span",
key: null,
ref: null,
props: {
className: this.props.someProp
},
_owner: null
};
}
});

View File

@ -38,6 +38,7 @@ export default function ({ types: t }) {
}
function pushProp(objProps, key, value) {
if (t.isJSXExpressionContainer(value)) value = value.expression;
objProps.push(t.objectProperty(key, value));
}