Skip to content

Default values for component parameters get overwritten #6864

Closed
@danroth27

Description

  • Create a new Razor Components app

  • Add a parameter to the Counter component with a default value of 1

    [Parameter] int IncrementAmount { get; set; } = 1;
    void IncrementCount()
    {
        currentCount+=IncrementAmount;
    }
  • Run the app and try the Counter on the Counter page

Expected result:

  • Counter increments

Actual result:

  • Counter doesn't increment - stays at zero
  • The IncrementAmount parameter was overwritten to zero

Metadata

Labels

DoneThis issue has been fixedarea-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions