Query DOM element without querySelector in LWC
The Spring 23 release of Salesforce introduced a new feature called "Query DOM Elements with Refs" that allows developers to use refs to access elements in shadow DOM and light DOM.
Refs locate DOM elements without a selector and only query elements contained in a specified template. Previously, developers could only use `querySelector()` to locate specific DOM elements.
This new feature provides developers with more flexibility and control when building LWC templates. By using refs, developers can easily access and manipulate specific DOM elements without having to rely on selectors. This can help improve the performance and maintainability of LWC templates.
Note: With the template refs API, you don’t need your element to have an ID or class (once needed for a querySelector) to create those references.