How to use the isJSXOpeningElement function from babel-types
Find comprehensive JavaScript babel-types.isJSXOpeningElement code examples handpicked from public code repositorys.
GitHub: dwqs/vue-to-react

123 124 125 126 127 128 129 130 131 132
babelTraverse(rast, { ClassMethod (path) { if (path.node.key.name === 'render') { path.traverse({ JSXIdentifier (path) { if (t.isJSXClosingElement(path.parent) || t.isJSXOpeningElement(path.parent)) { const node = path.node; const componentName = state.components[node.name] || state.components[parseComponentName(node.name)]; if (componentName) { path.replaceWith(t.jSXIdentifier(componentName));
babel-types.identifier is the most popular function in babel-types (4076 examples)