I have this component (below) and I have this value HasFetched
which is updated in another component, I can see the state
has been updated correctly via the redux dev tools, but I am not able to trigger the function FetchData
when the value has been
updated.
@inject IState<HomeState> HomeState
@inject IMediator Mediator
@if(datas != null)
{
<p>This is data: @data</p>
}
@code {
private string data;
[Parameter] public bool HasFetched { get; set; }
protected override async Task OnInitializedAsync()
{
if(HasFetched == default)
{
HasFetched = HomeState.Value.HasFetched;
}
}
protected override async Task OnParametersSetAsync()
{
await FetchData();
}
private async Task FetchData()
{
// Fetch the data
_data = await Mediator.Send(...);
}
}