+ 6
How to stop element inside a functional component from bubbling up to the body element? [Solved]
In the following code if you click on body the element disappears but I want that if I click on element , particularly those 3 dots it shudn't disappear and I tried using e.stopPropagation() but it doesn't work for some reason that I don't understand https://code.sololearn.com/WP99GA8yDcg5/?ref=app
5 Réponses
0
You can see what element was clicked on with e.target. using e.target.id you can identify then handle what functions you want to run accordingly.
0
JME it prints nothing
0
It will print nothing if the element has no id
0
JME oh yea ,thks I thought id meant something else!! And it definitely targets that element on click as I have looked out and even styled the dots but stopPropagation() doesn't works just