isClientReactApi

tcmts.cli.placement.isClientReactApi · #o4q6xpld · term · runs anywhere

React APIs that only work in a component instance the browser keeps alive: hooks, portals.

export const isClientReactApi = (e: { module: string; export: string }) =>
  /^npm:react(-dom)?@/.test(e.module) &&
  /^(use[A-Z]\w*|use|createPortal|flushSync)$/.test(e.export)

used by