Vue 3.5.0-alpha.3 - Появился новый компосабл useId() для генерации ID в компонентах. #vue_3_5 #changelog
const inputId = useId()
Зачем генерировать ID?
Типичный use-case - id элементов, например, форм и атрибуты для доступности.
Почему не просто `Math.random()` или `nanoid()`?
Результат получается невоспроизводимым, что усложняет тестирование и не работает на SSR
Почему не просто `id++`?
Такое решение может приводить к дублированию ID. Например, и в вашем приложении, и в UI фреймворке могли сделать input-label-${id++}.
Чтобы облегчить жизнь разработчиков, добавили долгожданный useId, возвращающий уникальный ID, префикс которого можно настроить в конфиге Vue приложения.
Vue 3.5.0-alpha.3 - Появился новый компосабл useId() для генерации ID в компонентах. #vue_3_5 #changelog
const inputId = useId()
Зачем генерировать ID?
Типичный use-case - id элементов, например, форм и атрибуты для доступности.
Почему не просто `Math.random()` или `nanoid()`?
Результат получается невоспроизводимым, что усложняет тестирование и не работает на SSR
Почему не просто `id++`?
Такое решение может приводить к дублированию ID. Например, и в вашем приложении, и в UI фреймворке могли сделать input-label-${id++}.
Чтобы облегчить жизнь разработчиков, добавили долгожданный useId, возвращающий уникальный ID, префикс которого можно настроить в конфиге Vue приложения.
To upload a logo, click the Menu icon and select “Manage Channel.” In a new window, hit the Camera icon. Telegram users themselves will be able to flag and report potentially false content. During a meeting with the president of the Supreme Electoral Court (TSE) on June 6, Telegram's Vice President Ilya Perekopsky announced the initiatives. According to the executive, Brazil is the first country in the world where Telegram is introducing the features, which could be expanded to other countries facing threats to democracy through the dissemination of false content. So far, more than a dozen different members have contributed to the group, posting voice notes of themselves screaming, yelling, groaning, and wailing in various pitches and rhythms. Those being doxxed include outgoing Chief Executive Carrie Lam Cheng Yuet-ngor, Chung and police assistant commissioner Joe Chan Tung, who heads police's cyber security and technology crime bureau.
from us