Just replace that one liner with a 15 liner.
And for React: https://javascript.info/custom-elements
$('.sth').closest('ul')
To me jQuery is like Regex or Linq. I think it had a really good api.https://developer.mozilla.org/en-US/docs/Web/API/Element/clo...
So the actually drop-in replacement of `$(foo).closest(bar)` would be something like:
Array.from(document.querySelector(foo)).map(el => el.closest(bar)) document.getElementsByClassName('sth')[0]?.closest('ul'); Array.from(document.getElementsByClassName("sth")).map(e => e.closest("ul"))
The jQuery is definitely nicer to read than this though