I am new to ASP.NET Core. I get this error when I use view component. Thank you for your help
InvalidOperationException: Method 'Invoke' of view component 'UI.ViewComponents.NavbarViewComponent' cannot return a Task.
This is my code
public async Task<IViewComponentResult> Invoke()
{
var settings = await _db.Settings.ToListAsync();
return View(settings);
}
And in view :
@await Component.InvokeAsync("Navbar")