diff --git a/packages/babel-core/test/fixtures/transformation/optimisation.react.inline-elements/key/actual.js b/packages/babel-core/test/fixtures/transformation/optimisation.react.inline-elements/key/actual.js
index f85670ba0b..e2b73e4d6f 100644
--- a/packages/babel-core/test/fixtures/transformation/optimisation.react.inline-elements/key/actual.js
+++ b/packages/babel-core/test/fixtures/transformation/optimisation.react.inline-elements/key/actual.js
@@ -1 +1 @@
-
+
diff --git a/packages/babel-core/test/fixtures/transformation/optimisation.react.inline-elements/key/expected.js b/packages/babel-core/test/fixtures/transformation/optimisation.react.inline-elements/key/expected.js
index bd4e4b0ae2..98d26d8cb7 100644
--- a/packages/babel-core/test/fixtures/transformation/optimisation.react.inline-elements/key/expected.js
+++ b/packages/babel-core/test/fixtures/transformation/optimisation.react.inline-elements/key/expected.js
@@ -3,6 +3,8 @@
type: Foo,
key: "foo",
ref: null,
- props: babelHelpers.defaultProps(Foo.defaultProps, {}),
+ props: babelHelpers.defaultProps(Foo.defaultProps, {
+ "data-value": "bar"
+ }),
_owner: null
-});
\ No newline at end of file
+});
diff --git a/packages/babel-plugin-transform-react-inline-elements/src/index.js b/packages/babel-plugin-transform-react-inline-elements/src/index.js
index 320d8d718e..112c47af4f 100644
--- a/packages/babel-plugin-transform-react-inline-elements/src/index.js
+++ b/packages/babel-plugin-transform-react-inline-elements/src/index.js
@@ -55,7 +55,9 @@ export default function ({ types: t }) {
if (isJSXAttributeOfName(attr, "key")) {
key = attr.value;
} else {
- pushProp(props.properties, t.identifier(attr.name.name), attr.value || t.identifier("true"));
+ let name = attr.name.name;
+ let propertyKey = t.isValidIdentifier(name) ? t.identifier(name) : t.stringLiteral(name);
+ pushProp(props.properties, propertyKey, attr.value || t.identifier("true"));
}
}