Newbie question and maybe this is a consequence of doing so much client-side development, but why do I generally not see elements assigned an Id value?
Newbie question and maybe this is a consequence of doing so much client-side development, but why do I generally not see elements assigned an Id value?
Blazor components are just placeholders for stuff that is rendered to the DOM.
Assigning ids to them won't help because you won't find e.g. a <counter> element once the page has been rendered.
However, you can, of course, assign ids to the HTML elements which are rendered by your component.
e.g the component can look like this
<h1 id="myCounter">Counter</h1>
<p>Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>