Skip to content

Add a built-in Environment component #63689

@danroth27

Description

@danroth27

MVC & Razor Pages have an environment tag helper for rendering content based on the current environment. In Blazor, you have to inject either the IHostEnvironment or IWebAssemblyHostEnvironment services and then write conditional rendering logic. This is tricky to do correctly for components that run on WebAssembly and are prerendered because you don't have a common why to get the environment that works for server and client. We have complicated explanations in the Blazor docs on how to handle this. We should consider just adding an Environment component, similar to the environment tag helper, that makes it easy to render content based on the current environment.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions