How to use the JSXAttribute function from babel-types

Find comprehensive JavaScript babel-types.JSXAttribute code examples handpicked from public code repositorys.

13
14
15
16
17
18
19
20
21
22
        t.jSXClosingElement(t.JSXIdentifier(nodeName)),
        children
    );
},
createAttribute(name, value) {
    return t.JSXAttribute(
        t.JSXIdentifier(name),
        typeof value == 'object' ? value : t.stringLiteral(value)
    );
},
fork icon330
star icon0
watch icon1

144
145
146
147
148
149
150
151
152
153
  attributes.push(attrs.createPropsAttrs(key, props[key]));
}

// 固定添加context属性,用于传递容器节点
attributes.push(
  t.JSXAttribute(
    t.JSXIdentifier("context"),
    t.JSXExpressionContainer(t.Identifier("contextProp"))
  )
); 
fork icon0
star icon1
watch icon0

+ 14 other calls in file

23
24
25
26
27
28
29
30
31
32
33
34
            break;
        }
    }


  
    return t.JSXAttribute(t.JSXIdentifier(name),attribute);
  }
}


/**
fork icon0
star icon1
watch icon0

Other functions in babel-types

Sorted by popularity

function icon

babel-types.identifier is the most popular function in babel-types (4076 examples)