properly handle shorthand JSX attributes in optimisation.react.inlineElements transformer - fixes #1309
This commit is contained in:
@@ -57,7 +57,7 @@ export function JSXElement(node, parent, scope, file) {
|
||||
if (isJSXAttributeOfName(attr, "key")) {
|
||||
key = attr.value;
|
||||
} else {
|
||||
pushProp(props.properties, attr.name, attr.value);
|
||||
pushProp(props.properties, attr.name, attr.value || t.identifier("true"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<Foo bar />;
|
||||
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
({
|
||||
type: Foo,
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Foo.defaultProps, {
|
||||
bar: true
|
||||
}),
|
||||
key: null
|
||||
});
|
||||
Reference in New Issue
Block a user