Hey Reader,
In this week's newsletter, I'm focusing on a fundamental yet often misunderstood aspect of Blazor in .NET 8 - prerendering in the new render modes (Server, WebAssembly, and Auto).
You have two choices: watch the video below, which illustrates the common issue with prerendering, or continue reading for the code details.
It's quite straightforward. When you opt for one of Blazor's new rendering modes in .NET 8 - Server, WebAssembly, or Auto - you'll need to use the @rendermode directive. This directive allows you to select one of these modes for either a page or a component:
Here's an important note: if you're loading data, for example, prerendering is on by default. This can cause an unsightly flicker. Observe in the gif below how the values change twice upon page reload.
That's prerendering for you. While it might be beneficial for SEO, there are times when it's not desirable due to the negative impact on user experience.
To address this, simply instantiate the render mode of your choice and set the prerender parameter to false.
This solution is applicable to all render modes and is also useful if you're looking to modify the effect for specific components rather than an entire page.
💌 Now It's Your Turn! How do you feel about prerendering? When and where would you use it?
A huge thank you to our community, and special gratitude to my Patrons for their steadfast support. Your contributions are vital to the success of this newsletter and my YouTube channel.
Excited for our next coding journey together. Stay safe and happy coding! 💻
Take care,
Patrick
Become a .NET & Blazor expert with weekly tutorials featuring best practices and the latest improvements, right in your inbox.
Hey Reader, Last week, I tested GPT-5 Agent Mode on .NET and Blazor apps, and the results were surprising. This week, I went a step further. I used GitHub Copilot inside Visual Studio and asked it to create real .NET and Blazor projects for me. Here’s what happened: Copilot generated a working calculator app in C#. It built a Web API that responded with “Hello GPT-5 Agents.” It even created a Blazor app with extra features like a reset button, a plus five counter, and a weather API. Were...
Hey Reader, I just published a new video where I put GPT-5’s Agent Mode to the test. 🚀 Instead of asking it for something simple, I went all in: A .NET 9 console app calculator A Web API with endpoints and docs A Blazor Server app with extra counter buttons And even a Blazor app that calls a public weather API 🎥 Watch it now: In the video, I didn’t just type “make me an app” and hope for the best. I gave GPT-5 very specific prompts, like: “Please create a .NET 9 console application that works...
Hey Reader, I’m back! 🎉 I’ve been on parental leave for the past 2 months, enjoying time with the family. Now I’m diving back into videos and here’s the first one! 🎥 Watch it now: Here’s the TL;DR if you can’t click right now: AI can already write code, fix bugs, and explain complex concepts. So… are we doomed? No. AI isn’t replacing developers anytime soon. But: Developers who use AI will replace those who don’t. The best devs are using GPT to: Skip repetitive work Prototype faster Learn...