What is the difference between using @bind and @bind-value?

Platform: Blazor| Category: General

In Blazor, there is no significant difference between using these two attributes. The @bind attribute is a shorthand of the @bind-value attribute and its delegate will trigger the ValueChanged event of the component.
The usage of both the @bind and @bind-value attributes in the following code examples are functionally equivalent.

@bind

<input type="text" @bind="user" />

@bind-value

<input type="text" @bind-value="user" @bind-value:event="onchange"/>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.