how to set displayName in a functional component [React]

后端 未结 3 1846
情书的邮戳
情书的邮戳 2020-12-17 07:37

I know that setting the displayName is sometimes required especially when you\'re dealing with production builds. I want to know how to set it using my function

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-17 08:38

    Figured it out

    const MyComponent = props => {
      return (
        

    How you doin?

    ) } MyComponent.displayName = "MyComponent"

提交回复
热议问题