10 JavaScript Interop
Join our book community on Discord
https://packt.link/EarlyAccess
In this chapter, we will take a look at JavaScript. In certain scenarios, we still need to use JavaScript or we want to use an existing library that relies on JavaScript. Blazor uses JavaScript to update the Document Object Model (DOM), download files, and access things such as local storage on the client.
So, there are, and always will be, cases when we need to communicate with JavaScript, or have JavaScript communicate with us. Don’t worry. The Blazor community is an amazing one, so chances are someone has already built the interop that we need.
In this chapter, we will cover the following topics:
- Why do we need JavaScript?
- .NET to JavaScript
- JavaScript to .NET
- Implementing an existing JavaScript library
Technical requirements
Make sure that you have followed the previous chapters or use the Chapter09 folder as a starting point.
You can find the source code for this chapter’...