R
R
Roman2019-10-17 23:51:24
React
Roman, 2019-10-17 23:51:24

How do you reach pseudo-elements (::after,::before), ref in React?

Hello, I’m making an adaptive in a mini application on react, and I had to reach the component in which the burger menu, when clicked, turn on the mobile navigation (I think it’s understandable), I googled that you can reach it using ref’ov - I did it, BUT I want the burger button when the click became a cross and back, I wrote everything manually (1 span and two pseudo-elements inside it: after, before) so how do I get through to these pseudo-elements so that when they click, change their styles ?? Is it possible with refs? I don’t know how, or is it impossible to make such a burger menu on react? I don’t want to do a pop-up menu on the side, I’m new to React, I hope the essence of the issue is clear, thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dnebl, 2019-10-17
@Isildur12

Before, after cannot be reached.
It is better to change the class, which in turn will change the pseudo-elements.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question