Skip to content
Advertisement

Applying CSS by Component’s displayName?

Calling all experts!

I am trying to add a class to disable all element’s descendants to be read only, the style is fine, but it doesn’t applied to all descendants nor any:

JavaScript

The element is a component that I want to have the above style by displayName as div id, like so:

JavaScript

The output HTML:

enter image description here

The final result should show the component has the style cascade to all its children.

Is that even possible?

Thanks in advance to all of the participants.

Advertisement

Answer

It seems that I don’t need to use id attribute after all. It is sufficient to define class rule as the displayName:

JavaScript

Then you can pick the style with the component’s displayName as follow:

JavaScript

Finally, the styles will apply to all descendant elements of the component.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement