"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx

fwdays 175 views 19 slides Jul 20, 2024
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

I will share my personal experience of full-time development on wasm Blazor
What difficulties our team faced: life hacks with Blazor app routing, whether it is necessary to write JavaScript, which technology stack and architectural patterns we chose
What conclusions we made and what mistakes we comm...


Slide Content

About me 13 years of experience with .NET stack .NET Consultant in GlobalLogic, CTO in Nearshore Devs Founder of UA .NET communities Blogger / Speaker / Microsoft MVP Front-end experience : ~5 years of Full-stack experience with: JS, JQuery, Angular, etc 10 month of full-time FE development using wasm Blazor

Last project t ech stack : One more SaaS project .NET 8, wasm Blazor MudBlazor component library Blazored.LocalStorage / SessionStorage Auto-generated Http clients Blazor App Insight for Telemetry NUnit + NSubstitute + FluentAssertions Browser-specific: JavaScript + WebPack html5/css3/flexbox/css grid

Tips & Tricks : Application design

Routing enhancements Routing using Enums is more convenient and does not rely on URI schema changing. That approach will have less error in enterprise-scale applications. Pages are mapped to enums like one-to-one. Conventions are good. Let’s separate “Pages” from “Components”. This approach makes code more readable. My package introduces a policy to restrict having routable components without a “Page” postfix. Do not reinvent the wheel when implementing “go on the previous page”, checking which is the “Current” page, parsing query string, etc.

BlazorNexus.Navigation nuget package https://github.com/VladislavFurdak/BlazorNexus Source code:

Nesting in components https://github.com/VladislavFurdak/FWDays2024Demos

Nesting in components https://github.com/VladislavFurdak/FWDays2024Demos

MVVM components interaction ViewModels Events Properties Methods Keeps state Services catch exceptions API Clients Repositories LocalStorage SessionStorage Razor Views Subscription on events Lifecycle of Pages Http calls

MVVM components interaction Skype window Contacts Current chat Contact Item Message Item Last messages NavBar Search Chat Settings State Object Events NewChatAdded ChatSettingsChanged New message recieved OnInit -> Subscribe -> NotifyStateChanged

Tips Tricks : JavaScript in Blazor

JS in Blazor JS interop is not fast Try to warp & forget js code into some Blazor components or use 3rd party Sometimes Blazor 3rd party packages has poor quality or abandoned

My experience to write JavaScript inside Blazor app It is legal to C all JS functions from Blazor Call C# methods from Browser We used Js interop for Infinite scroll Managing google ReCaptcha Local/Session storages Payments widget integration Browser API like MediaRecorder

Blazor Pros & Cons

Is Blazor the replacement for React or Angular? NO, Blazor is a good alternative to Web Forms or asp.net MVC

Blazor vs Modern FE frameworks When Blazor loses NPM Ecosystem >>>>> Nuget Blazor packages JS Labor market >>> Blazor devs amount Custom dynamic behavior using browser API When Blazor equals Rapid development of SPA using UI libraries like Telerik, Radzen, DevExpress, SyncFusion SSR (Blazor Server, Hybrid) MAUI hybrid apps When Blazor win Re-using of existing C# code Reduce an entry threshold in front-end for C# developers

Conclusions

Lessons we learned Be in touch with Product Designer on the stage of UI/UX development. Always start your project from Component Library (Storybook clone https://github.com/jsakamoto/BlazingStory ). I don’t recommend to use MudBlazor structured elements like: MudPaper, MudGrid, MudCard. Flexbox is faster & simpler. Determine which css helpers & which breakpoints will you use : Mud or Bootstrap. Decide will you use mobile native elements/events or not (MudBlazor does not support it)

Thanks Demos https://github.com/VladislavFurdak/FWDays2024Demos JOIN my TG Community