Challenge: Adding JavaScript Interop

Test yourself by calling JavaScript code from Blazor C# code.

We'll cover the following

Overview

Using the project below, perform the tasks highlighted in the Requirements section.

Requirements

In the project setup below, we have a JavaScript function defined on lines 31–33 of the index.html file in the wwwroot folder.

Nothing invokes this function at the moment, but you need to invoke it from the Counter Razor component. Every time the count is updated, you need to pass it to this function to notify the user about the new count.

Get hands-on with 1200+ tech skills courses.