Add helper methods for constructing a RazorComponentResult
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
This is to follow up on https://github.com/dotnet/aspnetcore/pull/47023#issuecomment-1458553319 and https://github.com/dotnet/aspnetcore/pull/47023#issuecomment-1458559036
Currently, you have to construct a RazorComponentResult manually, e.g.:
```cs
// Minimal
endpoints.Map("/mypage", () => new RazorComponentResult());
// MVC
public IResult MyPage()
=> new RazorComponentResult(new { Greeting = "Hmm" });
```
For consistency with other built-in result types, we probably also want helpers so you can do things like:
```cs
// Minimal
endpoints.Map("/mypage", () => Results.RazorComponent());
// MVC
public IResult MyPage()
=> RazorComponent(new { Greeting = "Hmm" });
```
Contributor guide
Assessment
This issue has not been assessed yet.