Last active
June 18, 2021 06:27
-
-
Save simonziegler/5c54c1a904ef7706ba2a45653753f894 to your computer and use it in GitHub Desktop.
CascadingValue is hopefully not null
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if (stuff) | |
{ | |
<div>Stuff</div> | |
} | |
else | |
{ | |
<div>More Stuff</div> | |
} | |
@code | |
{ | |
[CascadingParameter] | |
private WrapperComponent TheWrapper { get; set; } | |
protected override void OnInitialized() | |
{ | |
base.OnInitialized(); | |
// `TheWrapper` should not be null here | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@page "/mypage" | |
<WrapperComponent> | |
<ChildComponent /> | |
</WrapperComponent> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Recyclarr.Radarr | |
<CascadingValue Value="this" IsFixed="true"> | |
<div> | |
@if (some_error_occurred) | |
{ | |
<div>Show an error</div> | |
} | |
else | |
{ | |
@ChildContent | |
} | |
</div> | |
</CascadingValue> | |
@code { | |
[Parameter] | |
public RenderFragment ChildContent { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment