V
V
volucris12021-04-08 15:23:29
JavaScript
volucris1, 2021-04-08 15:23:29

How to access the child element in React when defining a class?

<li className={this.setActive('/categories')}>
    <a href={'/categories'}>Категории</a>
</li>

When setting the class, it is necessary to get access to the element to which the class is set, how to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WebEagle, 2021-04-08
@volucris1

React.createRef can be used
https://reactjs.org/docs/refs-and-the-dom.html#cre...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question