Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Transform Anonymous ComponentNew to Visual Studio Code? Get it now.
Transform Anonymous Component

Transform Anonymous Component

equotauser

|
17 installs
| (0) | Free
为React转化匿名组件
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

transform-anonymous-component

为React转化匿名组件为具名组件,分别使用了AST转化和Reg转化

快捷方式

OS AST Reg
win ctrl+shift+T alt+shift+T
mac ctrl+cmd+T alt+cmd+T

转化规则

组件名Home为所在文件夹的名称

// before
export default () => {};

// after
const Home: React.FC<any> = () => {};
export default Home;
// before
export default function () {}

// after
const Home: React.FC<any> = () => {};
export default Home;
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft