Do not quote JSX attribute keys for IdentifierName (#8045)
Given the following
```js
a = <F new/>
```
We used to generate:
```js
a = React.createElement(F, {"new": true})
```
but now we generate
```js
a = React.createElement(F, {new: true})
```
If you need to quote these (ie for ES3 you can use
transform-property-literals)
This commit is contained in:
committed by
Justin Ridgewell
parent
d45ee5e025
commit
7846eaebaa
1
packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/input.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/react/should-add-quotes-es3/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var es3 = <F aaa new const var default foo-bar/>;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-react-jsx", "transform-property-literals"]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
var es3 = React.createElement(F, {
|
||||
aaa: true,
|
||||
"new": true,
|
||||
"const": true,
|
||||
"var": true,
|
||||
"default": true,
|
||||
"foo-bar": true
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
var e = <F aaa new const var default foo-bar/>;
|
||||
@@ -0,0 +1,8 @@
|
||||
var e = React.createElement(F, {
|
||||
aaa: true,
|
||||
new: true,
|
||||
const: true,
|
||||
var: true,
|
||||
default: true,
|
||||
"foo-bar": true
|
||||
});
|
||||
Reference in New Issue
Block a user