How to Use Code Behind for Blazor Components | 2 Solutions
Usually, when we see Blazor components, the C# code handling the interaction for the component template is placed below the template within the same .razor file.
However, there are other ways to implement Blazor components. I will show two alternative approaches to splitting the template and the C# code into separate files.
00:00 Introduction
00:30 Reasons for Separating Code and Template
02:18 The Code-Behind Solution
04:02 Dependency Injection in Code-Behind
05:42 Inheriting from ComponentBase
07:26 Conclusion
🔥 The FREE Blazor Crash Course:
https://www.youtube.com/watch?v=89Klc6WHElw&list=PLwISgxnkpZGL_LhTQCWwp-WCzupv7lcp0
📌 C# Programming Playlist:
https://www.youtube.com/watch?v=dKBuvdGsYYc&list=PLwISgxnkpZGIrkQGwOj6kKXLT8CAp9Gct
✅ SUBSCRIBE FOR MORE VIDEOS
Subscribe: 🔔 https://claudiobernasconi.ch/Subscribe
🚀 CONNECT & SUPPORT
Patreon: https://patreon.com/claudiobernasconi
Twitter: https://www.twitter.com/CHBernasconiC
Blog: https://www.claudiobernasconi.ch