Summary
JavaScript interoperability enables you to write Blazor code that works with existing JavaScript libraries, or invoke .NET code from JavaScript.
A Blazor component has a well-defined lifecycle. You can hook into the events that are triggered when a component is created, initialized, and rendered, and then add custom logic by overriding the lifecycle methods the ComponentBase
class provides.
You can create Blazor template components that you reuse across multiple applications and adapt for different scenarios.
In this module, you learned how to:
- Call JavaScript functions from .NET code and call .NET code from JavaScript in Blazor apps.
- Handle events in the Blazor component lifecycle.
- Change component display by passing it a template.
Learn more
- Blazor app building workshop
- Call JavaScript functions from .NET methods in ASP.NET Core Blazor
- Call .NET methods from JavaScript functions in ASP.NET Core Blazor
- ASP.NET Core Blazor templated components
- ASP.NET Core Razor component lifecycle
- Places where errors may occur