Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update render fragment example #30118

Closed
danroth27 opened this issue Aug 22, 2023 · 1 comment · Fixed by #30119
Closed

Update render fragment example #30118

danroth27 opened this issue Aug 22, 2023 · 1 comment · Fixed by #30119

Comments

@danroth27
Copy link
Member

This page shows defining a RenderFragment using the older lambda pattern with a __builder parameter:

<h1>Hello, world!</h1>

@RenderWelcomeInfo

<p>Render the welcome info a second time:</p>

@RenderWelcomeInfo

@code {
    private RenderFragment RenderWelcomeInfo = __builder =>
    {
        <p>Welcome to your new app!</p>
    };
}

But I believe the preferred way to define this RenderFragment is like this:

<h1>Hello, world!</h1>

@RenderWelcomeInfo

<p>Render the welcome info a second time:</p>

@RenderWelcomeInfo

@code {
    private RenderFragment RenderWelcomeInfo =  @<p>Welcome to your new app!</p>;
}

This page already links to https://learn.microsoft.com/aspnet/core/blazor/performance#define-reusable-renderfragments-in-code which shows the preferred syntax.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@dotnet-bot dotnet-bot added Blazor Source - Docs.ms Docs Customer feedback via GitHub Issue labels Aug 22, 2023
@guardrex
Copy link
Collaborator

Yes ... it got under the radar. It was updated at ...

https://learn.microsoft.com/en-us/aspnet/core/blazor/performance?view=aspnetcore-7.0#define-reusable-renderfragments-in-code

... but not here. I'll take care of it. 🏃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants