How to use the isJSXElement function from babel-types
Find comprehensive JavaScript babel-types.isJSXElement code examples handpicked from public code repositorys.
91 92 93 94 95 96 97 98 99 100
ThisExpression (thisPath) { const parentNode = thisPath.parentPath.parentPath.parent; const isValid = t.isExpressionStatement(parentNode) || t.isVariableDeclaration(parentNode) || t.isBlockStatement(parentNode) || t.isJSXElement(parentNode) || t.isCallExpression(parentNode) || (t.isJSXAttribute(parentNode) && !parentNode.name.name.startsWith('on')); if (isValid) {
64
411
8
GitHub: captainwz/react-pocket
166 167 168 169 170 171 172 173 174 175
if (t.isCallExpression(p.node) && t.isMemberExpression(p.node.callee) && p.node.callee.object.name == 'ReactDOM' && p.node.callee.property.name == 'render' && t.isJSXElement(p.node.arguments[0])) { let el = p.node.arguments[0].openingElement; objArr.forEach(obj => {
1
11
1
+ 3 other calls in file
GitHub: zacks223/jsx2json
70 71 72 73 74 75 76 77 78 79
JSXAttribute: path => { const node = path.node; const key = node.name.name; const value = getPropValue(node.value); const parent = path.findParent(path => { return types.isJSXElement(path.node) }); const parentJsonNode = parent.node.__jsonNode; if (!parentJsonNode.props) { parentJsonNode.props = {};
1
6
0
+ 3 other calls in file
67 68 69 70 71 72 73 74 75 76
}, }, JSXAttribute(path) { const { node } = path const parent = path.findParent(p => types.isJSXElement(p.node)) const parentNode = parent.node.__node if (!parentNode.props) { parentNode.props = {} }
1
4
2
+ 3 other calls in file
babel-types.identifier is the most popular function in babel-types (4076 examples)