Skip to content

Support TypeScript namespace  #8941

Description

@xiaoxiangmoe

https://github.com/welldone-software/why-did-you-render

You can also manually track any component you want by setting whyDidYouRender on them like this:

function BigListPureComponent() {
  return <div>
    //some heavy component you want to ensure doesn't happen if its not neceserry
  </div>
}
BigListPureComponent.whyDidYouRender = true

In TypeScript, if we want whyDidYouRender be readonly, we should write:

function BigListPureComponent() {
  return <div>
    //some heavy component you want to ensure doesn't happen if its not neceserry
  </div>
}
namespace BigListPureComponent {
  export const whyDidYouRender = true;
}

But CRA doesn't support namespace now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions