What's NEW in Blazor in .NET 8?!

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 24. 06. 2024
  • NET 8 is finally here, and I'm excited to share what's new in Blazor with .NET 8. It is not an exaggeration to say that Blazor has fundamentally changed!
    There is a new project template with a new file structure, new rendering modes, stream rendering, enhanced navigation, and new authentication components.
    00:00 Introduction
    00:45 The new Blazor Project Templates
    02:02 The Blazor Web App Project Template
    05:22 Exploring Static Server Rendering (SSR)
    07:30 Exploring Blazor Server Interactivity
    08:32 Exploring Blazor WebAssembly Interactivity
    09:49 Interactivity per Component Usage
    13:28 Exploring Stream Rendering
    15:28 Enhanced Navigation with Blazor in .NET 8
    17:20 Outro
    📌 .NET 8 Announcement Blog Post:
    devblogs.microsoft.com/dotnet...
    📌 .NET 8 Blazor Announcement (Blog Post):
    devblogs.microsoft.com/dotnet...
    đŸ”„ C#/.NET Bootcamp: The Fundamentals & more (Code FRIENDS10 for 10% OFF)*
    claudiobernasconi.ch/dotnet-c...
    📌 .NET Developer Roadmap
    claudiobernasconi.ch/learn-do...
    📌 CZcams Playlists:
    The FREE Blazor Crash Course: ‱ The FREE Blazor Crash ...
    Blazor: ‱ Blazor
    ✅ SUBSCRIBE FOR MORE VIDEOS
    Subscribe: 🔔 claudiobernasconi.ch/Subscribe
    🚀 CONNECT & SUPPORT
    Twitter: / chbernasconic
    Blog: claudiobernasconi.ch
    Newsletter: claudiobernasconi.ch/newsletter
    * Affiliate Link: I earn a small commission at no additional cost
  • Věda a technologie

Komentáƙe • 18

  • @ClaudioBernasconi
    @ClaudioBernasconi  Pƙed 6 měsĂ­ci +1

    What do you think about Blazor in .NET 8? đŸ€”

    • @10Totti
      @10Totti Pƙed 6 měsĂ­ci

      and if we have to create a wasm or server component, do we also have to write the double backend?

  • @10Totti
    @10Totti Pƙed 6 měsĂ­ci +1

    Great Tutorial Thanks!

  • @ParthibanElangovanCool
    @ParthibanElangovanCool Pƙed 6 měsĂ­ci

    Nice tutorial !! Easy to learn

  • @zimcoder
    @zimcoder Pƙed 6 měsĂ­ci

    Thanks!

  • @johnhershberg5915
    @johnhershberg5915 Pƙed 6 měsĂ­ci

    I find this a bit confusing. The render modes are per page it seems? It seems that for a page I can only choose one version of the render-mode. But can you mix and match? What if I want a WebAssembly client-side page, but have a button that calls a function on the server? If I go with WebAssembly then I'll have to also introduce an API. If I go with server-side interactivity I can invoke functions on the server directly, but then small things like a UI panel opening and closing also has to go through the server, even though that can be client-side.
    I'm confused about how to mix and match the components on the page. Can I have a WebAssembly component on the same page as a server-interactive component?

    • @ClaudioBernasconi
      @ClaudioBernasconi  Pƙed 6 měsĂ­ci +2

      Great question! I might record another dedicated video where I explain the options we have in more detail. Yes, with .NET 8 you can have a render mode per component.
      A page always lives in either the "Server" or the "Client" project. If you want to use WebAssembly, you need to have the page in the Clients project. However, the components you use on that page can be developed within a Razor Class Library. We can then reference the components from both other projects making the components available for both render modes.
      In that case, you can have a tab component with a click handler existing using Blazor Server on one page, and using WebAssembly on another page. However, if you want to access data from a shared component, you either implement it with direct database access and limit it to Blazor Server, or you use an API client (effectively making it a WebAssembly component).
      So there is the concept of render components and logic components. Blazor is now very flexible to the point where it almost seems overwhelming when first encountering it. I suggest playing with it to see what works and what doesn't.

    • @johnhershberg5915
      @johnhershberg5915 Pƙed 6 měsĂ­ci

      @@ClaudioBernasconi I would love a video showing all those options. Specifically what I'm looking to do is have all UI-type interactions on the client side (wasm) and any thing that needs to happen on the server be server-side.

  • @bernhardesslinger2666
    @bernhardesslinger2666 Pƙed 6 měsĂ­ci

    I'd like to know how much effort is it to bring a desktop application written in C# and with WPF to the browser with .NET 8 and Blazor 8? Are there some examples or experiences already? Could you give some hints? Do you personally have experience with such a task?

    • @ClaudioBernasconi
      @ClaudioBernasconi  Pƙed 6 měsĂ­ci +1

      Thanks for your question. Depending on the application's size, it's going to be a big effort. In your situation, I'd suggest gradually migrating from one technology to the other.
      When migrating from WPF to Blazor (from desktop to web), I'd start writing new components using Blazor and use Blazor Hybrid as long as you aren't done rewriting your components. Another option could be to implement new features/areas in Blazor and have your clients run two different applications.
      I would not go in one single big bang from WPF on the desktop to Blazor on the web for a production application unless it's small enough so that you can rewrite it in less than a month. I hope this helps.

    • @eonasdan
      @eonasdan Pƙed 5 měsĂ­ci

      It's not actually that hard. I'm running a blog series where I use Blazor in a WPF app. I haven't updated it to dotnet 8 completely yet. The main window in your WPF just loads the WASM project, and you're basically good to go. I'm sharing a common Blazor WASM project between web, WPF and MAUI.

  • @waqasjavaid9274
    @waqasjavaid9274 Pƙed 2 měsĂ­ci

    how we use it as restful api to use with mobile app?

    • @ClaudioBernasconi
      @ClaudioBernasconi  Pƙed 2 měsĂ­ci

      For API development, you want to learn about ASP .NET Core WebAPI instead of Blazor.

  • @jayantguru298
    @jayantguru298 Pƙed 6 měsĂ­ci

    The idea that 2 different projects will be added based on certain selection is a big no for me. There should be only 1 project where the behavior of the application should change based on certain configuration. The developer would be able to set those configurations either in program.cs or in individual component.

    • @ClaudioBernasconi
      @ClaudioBernasconi  Pƙed 6 měsĂ­ci

      Thanks for your comment! There was a lot of discussion going on. The issue is that with a single project it is unclear what will be shipped to the client. It's not only a convenience issue but also a potential security issue. The whole discussion is public and I also stated my opinion before the decision was made. If you're curious, you can read more about it here: github.com/dotnet/aspnetcore/issues/49079