How to use the isJSXFragment function from @babel/types

Find comprehensive JavaScript @babel/types.isJSXFragment code examples handpicked from public code repositorys.

680
681
682
683
684
685
686
687
688
689

let returnsJSX = false;
path.traverse({
  ReturnStatement(path) {
    let ret = path.node.argument;
    if (t.isJSXElement(ret) || t.isJSXFragment(ret) || isReactCall(path.get('argument'), 'cloneElement') || isReactCall(path.get('argument'), 'createPortal', 'react-dom')) {
      returnsJSX = true;
    }
  }
});
fork icon689
star icon0
watch icon0

+ 461 other calls in file

511
512
513
514
515
516
517
518
519
520
if (path.isFunction()) {
  let returnsJSX = false;
  path.traverse({
    ReturnStatement(path) {
      let ret = path.node.argument;
      if (t.isJSXElement(ret) || t.isJSXFragment(ret) || isReactCall(path.get("argument"), "cloneElement") || isReactCall(path.get("argument"), "createPortal", "react-dom")) {
        returnsJSX = true;
      }
    }
  });
fork icon0
star icon1
watch icon0

+ 6 other calls in file

Other functions in @babel/types

Sorted by popularity

function icon

@babel/types.identifier is the most popular function in @babel/types (20936 examples)