1 |
3a515b92
|
cagy
|
# babel-helper-builder-react-jsx
|
2 |
|
|
|
3 |
|
|
## Usage
|
4 |
|
|
|
5 |
|
|
```javascript
|
6 |
|
|
type ElementState = {
|
7 |
|
|
tagExpr: Object; // tag node
|
8 |
|
|
tagName: string; // raw string tag name
|
9 |
|
|
args: Array<Object>; // array of call arguments
|
10 |
|
|
call?: Object; // optional call property that can be set to override the call expression returned
|
11 |
|
|
pre?: Function; // function called with (state: ElementState) before building attribs
|
12 |
|
|
post?: Function; // function called with (state: ElementState) after building attribs
|
13 |
|
|
};
|
14 |
|
|
|
15 |
|
|
require("babel-helper-builder-react-jsx")({
|
16 |
|
|
pre: function (state: ElementState) {
|
17 |
|
|
// called before building the element
|
18 |
|
|
},
|
19 |
|
|
|
20 |
|
|
post: function (state: ElementState) {
|
21 |
|
|
// called after building the element
|
22 |
|
|
}
|
23 |
|
|
});
|
24 |
|
|
```
|