How to use querySelector('#___') with react useId() generated id

preview_player
Показать описание
In most cases you don't need to use querySelector in react, especially with generated ids. But if by some reason you are going to, here I'll tell you how to do it right. During that I'll show you fucntion to escape id and explain how does it work.

Рекомендации по теме
Комментарии
Автор

Here is the fucntion code:
function escapeId(id) {
return id.replace(/\W/g, m => "\\" + m.charCodeAt(0).toString(16) + " ")
}

QwDragon
Автор

Thank you for making this. Please keep posting more. There is not a lot of advanced JavaScript videos on YT, only beginner focused.

_ingadi
welcome to shbcf.ru