Exploring binding
Using bindings, you can connect variables either within a component (so that it updates automatically) or by setting a component attribute.
In Blazor, we can bind values to components and there are two different ways to do this.
- One-way binding
- Two-way binding
By using binding, we can send information between components and make sure we can update a value when we want to.
One-way binding
One-way binding is something that we have already talked about in Chapter 4, Creating Basic Blazor Components. Let's take a look at the component again and continue to build on it in this section.
In this section, we will combine parameters and binding.
The Counter.razor
example looks like this:
@page "/counter" <h1>Counter</h1> <p>Current count: @currentCount</p> <button class="btn btn-primary" @onclick="IncrementCount">Click me</button> @code { Â Â Â Â private...