PreRenderComponent 0.1.0-beta-1

A Blazor Component that provides a visible PreRender flag to Razor Components

This is a prerelease version of PreRenderComponent.
Install-Package PreRenderComponent -Version 0.1.0-beta-1
dotnet add package PreRenderComponent --version 0.1.0-beta-1
<PackageReference Include="PreRenderComponent" Version="0.1.0-beta-1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PreRenderComponent --version 0.1.0-beta-1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

PreRenderComponent

Provides a CascadingValue exposing whether the app is in PreRendering or not.

Usage

Install the nuget https://nuget.org/packages/PreRenderComponent

Add references to Components/_ViewImports.cshtml

@using PreRenderComponent
@addTagHelper *, PreRenderComponent

Wrap the Router component in PreRenderCascade in the App.razor file

<PreRenderCascade>
    <Router AppAssembly="typeof(Startup).Assembly" />
</PreRenderCascade>

Consume the CascadingValue in your own pages/components

@if (IsPreRendering)
{
  <button class="btn btn-dark" onclick="@IncrementCount" disabled>Don't Click me</button>
}
else
{
  <button class="btn btn-primary" onclick="@IncrementCount">Click me</button>
}


@functions {
[CascadingParameter(Name = "PreRendering")] 
protected bool IsPreRendering { get; set; }
}

PreRenderComponent

Provides a CascadingValue exposing whether the app is in PreRendering or not.

Usage

Install the nuget https://nuget.org/packages/PreRenderComponent

Add references to Components/_ViewImports.cshtml

@using PreRenderComponent
@addTagHelper *, PreRenderComponent

Wrap the Router component in PreRenderCascade in the App.razor file

<PreRenderCascade>
    <Router AppAssembly="typeof(Startup).Assembly" />
</PreRenderCascade>

Consume the CascadingValue in your own pages/components

@if (IsPreRendering)
{
  <button class="btn btn-dark" onclick="@IncrementCount" disabled>Don't Click me</button>
}
else
{
  <button class="btn btn-primary" onclick="@IncrementCount">Click me</button>
}


@functions {
[CascadingParameter(Name = "PreRendering")] 
protected bool IsPreRendering { get; set; }
}

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.1.0-beta-1 110 3/12/2019