Adding a Parameter to a Component
Learn how to add parameters to components for customized functionality.
We'll cover the following
Most components require parameters. To add a parameter to a component, use the Parameter
attribute. We will add a parameter to specify the increment used by the IncrementCount
method. We do this as follows:
- Return to Visual Studio.
- Open the
Pages\Counter.razor
file. - Add the following code to the top of the code block to define the new parameter:
Get hands-on with 1400+ tech skills courses.