babel/packages/babel-helper-builder-react-jsx
Erik Arvidsson 7846eaebaa 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)
2018-05-27 12:48:18 -04:00
..
2017-03-25 21:46:16 -04:00
2018-05-25 09:00:02 -07:00

@babel/helper-builder-react-jsx

Usage

type ElementState = {
  tagExpr: Object; // tag node
  tagName: string; // raw string tag name
  args: Array<Object>; // array of call arguments
  call?: Object; // optional call property that can be set to override the call expression returned
};

require("@babel/helper-builder-react-jsx")({
  filter: function (element: JSXElement) {
    // if returns false, the element isn't transformed
  },

  pre: function (state: ElementState) {
    // function called with (state: ElementState) before building attribs
  },

  post: function (state: ElementState) {
    // function called with (state: ElementState) after building attribs
  },

  compat?: boolean // true if React is in compat mode
});