🎓 All Courses | 📚 Blazor WASM Syllabus
Stickipedia University
📋 Study this course on TaskLoco

Component parameters are how parent components pass data down to child components. They are C# properties decorated with the [Parameter] attribute.

Defining Parameters in a Child

// GreetingCard.razor
<div class="card">
    <h2>Hello, @Name!</h2>
    <p>@Message</p>
</div>

@code {
    [Parameter] public string Name { get; set; } = "";
    [Parameter] public string Message { get; set; } = "";
}

Passing Parameters from a Parent

<GreetingCard Name="Alice" Message="Welcome back!" />

CascadingParameters

For passing values deep through the component tree without threading them through every level:

<CascadingValue Value="currentUser">
    @Body
</CascadingValue>

// In a deeply nested child:
[CascadingParameter] public AppUser CurrentUser { get; set; }

Best Practices

  • Always give parameters default values to avoid null exceptions
  • Mark required parameters with [EditorRequired] for compile-time warnings
  • Never mutate parameters directly — use an EventCallback to notify the parent

YouTube • Top 10
Blazor WASM: Component Parameters
Tap to Watch ›
📸
Google Images • Top 10
Blazor WASM: Component Parameters
Tap to View ›

Reference:

Wikipedia: Component-Based Software Engineering

image for linkhttps://en.wikipedia.org/wiki/Component-based_software_engineering

📚 Blazor WASM — Full Course Syllabus
📋 Study this course on TaskLoco

TaskLoco™ — The Sticky Note GOAT