Why doesn't React Dev Tools display properties called "name"?

68 Views Asked by At

I have the following TypeScript object in a React project:

class ExampleClass {
    name: string;
    name2: string;
    favouriteThing: string;


    constructor(name: string, favouriteThing: string) {
        this.name = name;
        this.name2 = name;
        this.favouriteThing = favouriteThing;
    }
}

When viewing this object as part of a hook or prop in React Dev Tools, this is how it's displayed:

React Dev Tools screenshot displaying 2 ExampleClass objects with the properties "name2" and "favouriteThing"

Only the the properties name2 and favouriteThing are displayed.

I'm able to see that name does still exist on the object by outputting it to the console:

Console output displaying 2 objects with the properties "name", "name2", and "favouriteThing"

I would expect name to be displayed along with the other properties in React Dev Tools. Is there something special/reserved about a property called name? Is there a reason why name is not displayed?

0

There are 0 best solutions below