avatarNikolaos Skordilis

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2742

Abstract

urn</span> { <span class="hljs-attr">props</span>: { data, }, <span class="hljs-attr">revalidate</span>: <span class="hljs-number">300</span>, <span class="hljs-comment">// Re-generate page after 5 minutes</span> }; }</pre></div><ul><li>API response caching: Implement caching for API responses, reducing the load on your server and improving the response time.</li></ul><h1 id="aa6e">Lazy Loading</h1><p id="f805">Lazy loading is a technique to defer loading parts of your page until they’re actually needed. In Next.js, you can use dynamic imports to achieve this:</p><div id="f63f"><pre><span class="hljs-keyword">import</span> dynamic <span class="hljs-keyword">from</span> <span class="hljs-string">'next/dynamic'</span>;

<span class="hljs-keyword">const</span> <span class="hljs-title class_">DynamicComponent</span> = <span class="hljs-title function_">dynamic</span>(<span class="hljs-function">() =></span> <span class="hljs-keyword">import</span>(<span class="hljs-string">'../components/DynamicComponent'</span>));

<span class="hljs-keyword">function</span> <span class="hljs-title function_">MyPage</span>(<span class="hljs-params"></span>) { <span class="hljs-keyword">return</span> ( <span class="language-xml"><span class="hljs-tag"><<span class="hljs-name">div</span>></span> {/* Other content */} <span class="hljs-tag"><<span class="hljs-name">DynamicComponent</span> /></span> <span class="hljs-tag"></<span class="hljs-name">div</span>></span></span> ); }</pre></div><p id="7797">Lazy loading can significantly improve the initial page load time, especially for large applications.</p><h1 id="c8b6">Performance Tips</h1><p id="e48c">To further optimize SSR in Next.js, consider the following performance tips:</p><h1 id="1733">Resource Prioritization</h1><p id="0425">Prioritize critical resources for initial page load. Use the <code>next/head</code> component to define the order in which resources should be loaded. This is crucial for improving perceived performance.</p><div id="e8b4"><pre><span class="hljs-keyword">import</span> <span class="hljs-title class_">Head</span> <span class="hljs-keyword">from</span> <span class="hljs-string">'next/head'</span>;

<span class="hljs-keyword">function</span> <span class="hljs-title function_">MyPage</span>(<span class="hljs-params"></span>) { <span class="hljs-keyword">return</span> ( <span class="language-xml"><span class="hljs-tag"><<span class="hljs-name">div</span>></span> <span class="hljs-tag"><<span class="hljs-name">Head</span>></span> <span class="hljs-tag"><<span class="hljs-name">title</span>></span>My Page<span class="hljs-tag"></<span class="h

Options

ljs-name">title</span>></span> <span class="hljs-tag"><<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"preload"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/styles.css"</span> <span class="hljs-attr">as</span>=<span class="hljs-string">"style"</span> /></span> <span class="hljs-tag"><<span class="hljs-name">link</span> <span class="hljs-attr">rel</span>=<span class="hljs-string">"stylesheet"</span> <span class="hljs-attr">href</span>=<span class="hljs-string">"/styles.css"</span> /></span> <span class="hljs-tag"></<span class="hljs-name">Head</span>></span> {/* Page content */} <span class="hljs-tag"></<span class="hljs-name">div</span>></span></span> ); }</pre></div><h1 id="edb1">Code Splitting</h1><p id="f23c">Implement code splitting to load only the JavaScript necessary for the current page. This reduces the initial payload and speeds up the page load time.</p><div id="5a42"><pre><span class="hljs-comment">// Dynamic imports with code splitting</span> <span class="hljs-keyword">import</span> <span class="hljs-built_in">dynamic</span> from <span class="hljs-string">'next/dynamic'</span>;

<span class="hljs-keyword">const</span> DynamicComponent = <span class="hljs-built_in">dynamic</span>(() => <span class="hljs-keyword">import</span>(<span class="hljs-string">'../components/DynamicComponent'</span>));</pre></div><p id="21fb">By following these best practices and performance tips, you can optimize the Server-Side Rendering (SSR) in your Next.js applications for faster page loads and improved user experiences. Utilize the appropriate data fetching methods, implement caching strategies, embrace lazy loading, and consider resource prioritization and code splitting for the best results.</p><p id="c104">Remember that optimization is an ongoing process. Regularly monitor and analyze your application’s performance to identify areas for improvement. With the right approach, you can deliver blazing-fast SSR in your Next.js projects.</p><h1 id="52d4">Stackademic</h1><p id="7b7b"><i>Thank you for reading until the end. Before you go:</i></p><ul><li><i>Please consider <b>clapping</b> and <b>following</b> the writer! 👏</i></li><li><i>Follow us on <a href="https://twitter.com/stackademichq"><b>Twitter(X)</b></a>, <a href="https://www.linkedin.com/company/stackademic"><b>LinkedIn</b></a>, and <a href="https://www.youtube.com/c/stackademic"><b>YouTube</b></a><b>.</b></i></li><li><i>Visit <a href="http://stackademic.com/"><b>Stackademic.com</b></a> to find out more about how we are democratizing free programming education around the world.</i></li></ul></article></body>

EARNINGS REPORT | MEDIUM | WRITING | READING | MPP

How I Earned Almost $300 from Medium in November

And why I will probably not earn more than $100 in December

Oct 31, the start of my ‘virality’. Screenshot by author.

It is tradition for the first couple of days of each month to provide reports of how we did the previous one. It helps that such articles are quick and easy to write, quite unlike fiction and poetry or anything requiring lots of research.

There is no Muse of meta-Medium articles as far as I know, and if there is one she is probably gagged, duct-taped and under lock & key in some Medium vault in San Francisco, to prevent us from writing too good meta articles and enchant the algorithm.

One extra advantage of meta articles is that you get the images directly from Medium. No need to look for compatible images on Pixabay or Pexels and then try to make them unique or input endless strings of key words to some AI “artist” hoping it will not generate random crap like they usually do.

Anyway, this blurb intro is probably 1-min read worth, I think that’s enough filler. Let’s get down to business. In my header image I marked the first day of my ‘virality’ -assuming anything less than 1000 views per day can be considered viral- and this is its last day:

Nov 14, the end and peak of my ‘virality’. Of the 1,190 views 737 were from my viral story alone. Screenshot by author.

The virality of this October story lasted for 15 days. On Nov 14 I surpassed 10,500 views and 4,500 reads during the ‘Prev 30 days.’ Since Nov 15 that story has continued to pay though, even with barely any read minutes per day. I call these earnings ‘viral residues.’

To date it has collected 3.6K views (96% internal), 1000+ reads, 74+ hours of member read time and $188. In November alone it earned $177. My second best performer (this uncomfortably dark story, also for Redemption) is way behind that.

That is almost 2/3 of my total November earnings (see last screenshot at the end). In other words, had that story not gone viral I’d have barely reached $100. Therefore, without at least one similar story in December it will be difficult for me to surpass $100.

You never know though. Perhaps more stories of mine will perform modestly, e.g. five stories might make $40 each this month, with the rest getting the usual peanuts; on the other hand a lot of peanuts make peanut butter.

If I up my writing game -assuming that even matters to an AI curator or that it can even tell- and also do not get burned out from excessive reading, as I have a few times, that might happen.

So how much did I make in November? See in my last screenshot. Impressively in the last day of November I earned $10, most from ‘viral residues.’

Total November earnings. Screenshot by author.

I made $273 from Medium alone and if I add Ko-fi to that I made $300. In October I made $100. Not bad at all, but it will be nasty if I fall back to $100 this month.

I’ll try to ensure that does not happen, but absent algorithmic help there is only so much I can do. If only I knew how to extend a 24-hour day to a 72-hour one — or, alternatively, read & write three times faster. That would be sweet…😏

Another meta-article by Nikolaos, also not aided by a meta-Muse. They are a hard species to find 🥺

Check out this useful article by Natalie too. It focuses on the importance of article headlines:

Get my stories in your inbox 📬

Report
Writing
Reading
Humor
Geeky
Recommended from ReadMedium