Prev function is Jquery function. Is there an alternative to this in ReactJs? I did a lot of research. But I could not reach the result. I have tried before: previousElementSibling,previousSibling,nextElementSibling,nextSibling. They didn't solve my problem. Is there anybody who can help me about it?
$("#diagram path[marker-end*='url']").prev('text');
Does this code have a counterpart in ReactJs?
You shouldn't need jQuery if you work with React the way it's intended to:
A big difference between these two is that React works through the “virtual DOM”, whereas jQuery interacts with the DOM directly. The virtual DOM is a DOM implementation in memory that compares to the existing DOM elements and makes the necessary changes/updates. And that leads to much faster performance.
Source
Go through the docs and give it a try. You won't regret it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With