E
E
eugenedrvnk2020-04-25 16:00:30
React
eugenedrvnk, 2020-04-25 16:00:30

How to add a class to the root of a component?

There is a conditional <#Avatar/> component that has its own styling and all that.
Let's say that in some situation I need to add styling to the Avatar root element on top of the existing one, something like <#Avatar className="some-class" />

In vue, this class would simply be added to the root of the component, but how similar to do in react? Is it necessary to pass the class names with props and already in the component itself make sure that this prop is added to the class?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
twolegs, 2020-04-25
@twolegs

Is it necessary to pass the class names with props and do it in the component itself in such a way that this prop is added to the class?

Exactly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question