<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MD. Mahir FaisaL </title>
    <description>The latest articles on DEV Community by MD. Mahir FaisaL  (@mdmahirfaisal).</description>
    <link>https://dev.to/mdmahirfaisal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F821852%2Fc9752282-a2d3-4776-8894-a5365c545511.jpeg</url>
      <title>DEV Community: MD. Mahir FaisaL </title>
      <link>https://dev.to/mdmahirfaisal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mdmahirfaisal"/>
    <language>en</language>
    <item>
      <title>SSG and SSR in Next.JS</title>
      <dc:creator>MD. Mahir FaisaL </dc:creator>
      <pubDate>Sun, 06 Mar 2022 05:39:22 +0000</pubDate>
      <link>https://dev.to/mdmahirfaisal/ssg-and-ssr-in-nextjs-3a51</link>
      <guid>https://dev.to/mdmahirfaisal/ssg-and-ssr-in-nextjs-3a51</guid>
      <description>&lt;h2&gt;
  
  
  Is get Static Props only good for rendering static pages like About or Blogs
&lt;/h2&gt;

&lt;p&gt;get Static Props fetches data at build time when the code gets compiled into exe and serves to the client the rendered HTML. It is the fastest Static Site Generation, SSG. The contents are cached on CDN, which makes it even faster.&lt;br&gt;
However, it does not mean that it only servers static pages.&lt;br&gt;
get Static Props can be used with client-side fetching using libraries like react-query or swr to get up-to-date information in run-time.&lt;br&gt;
e.g. the About page makes a request to extreme-ip-lookup.com to find out user's city inside use Effect&lt;br&gt;
This has the advantage of&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Super fast TTFP (time to first paint) where user can see the page loaded instantly&lt;/li&gt;
&lt;li&gt;JS request, interactions will be added soon after when they are loaded and executed. The SSG pages are fast and still capable of providing up-to-date information and interactivity.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  When would you use get Server Side Props instead of get Static Props
&lt;/h2&gt;

&lt;p&gt;get Server Side Props fetches data at run time (when exe starts running) from server. It is server-side rendering.&lt;br&gt;
It is different from get Static Props in that:&lt;br&gt;
data is fetched at run time, not build time&lt;br&gt;
It provides better SEO as the data is rendered on server and available for crawler&lt;br&gt;
It is slower than SSG because HTML is generated at run time&lt;br&gt;
It can be faster than CSG because it is faster to make requests from server (but then you need to send the data back to client… hmm&lt;br&gt;
It is the same as get Static Props:&lt;br&gt;
Both can provide interactivity and up-to-date information (get Static Props work well with client-side fetching!)&lt;br&gt;
Main pages or at least templates are rendered on the server&lt;br&gt;
get Server Side Props is good when&lt;br&gt;
data is not static. Data needs to be fetched at run time&lt;br&gt;
SEO is important. We want the data to be pre-rendered&lt;br&gt;
e.g. Medium paid content. Users need to be authorized as a paid member to view the articles so the article suggestions are to be generated in run time. (The article itself should be available at build time though.. or the content is put together at run time?&lt;/p&gt;

&lt;h2&gt;
  
  
  How is get Initial Props different from get Server Side Props?
&lt;/h2&gt;

&lt;p&gt;get Initial Props is an older method. It runs first on the server side and then it is run again on the client side ever time is it called. It is slower than get Server Side Props because the code inside get Initial Props is executed in the run time, whereas the Next JS just calls an API to run get Server Side Props on the server, which then returns a JSON data to the client.&lt;br&gt;
It is the only method that runs on both server and client&lt;br&gt;
initial data-population from server: good for SEO!&lt;br&gt;
It is the only method that runs on _app.js&lt;br&gt;
In the discussion thread,&lt;br&gt;
ice hunter: get Initial Props has this benefit that&lt;br&gt;
SSR to prefetch data on Server first for better SEO&lt;br&gt;
subsequently fetching the data using CSR&lt;br&gt;
grepug: get Server Side Props request seems to block the transition during each transition on the client. See if this will go away in future.&lt;br&gt;
Here is a long informative discussion thread on the various use cases and issues with Next JS SSR.&lt;/p&gt;

</description>
      <category>nextjs</category>
    </item>
    <item>
      <title>Build a Next.js Website in 4 Steps
</title>
      <dc:creator>MD. Mahir FaisaL </dc:creator>
      <pubDate>Fri, 25 Feb 2022 17:21:52 +0000</pubDate>
      <link>https://dev.to/mdmahirfaisal/build-a-nextjs-website-in-4-steps-3m4c</link>
      <guid>https://dev.to/mdmahirfaisal/build-a-nextjs-website-in-4-steps-3m4c</guid>
      <description>&lt;p&gt;Carson Gibbons is the Co-Founder &amp;amp; CMO of Cosmic JS, an API-first Cloud-based Content Management Platform that decouples content from code, allowing devs to build slick apps and websites in any programming language they want.&lt;br&gt;
In this blog I will show you how to pick up an existing website example and curtail it into your own, beautiful Next.js website for publishing content and easy updates. This React Universal Website is built using the Next.js framework. Code is shared between the client and server making development a breeze. Add Cosmic JS-powered content and you’re taking your website to the Next.js level.&lt;br&gt;
Next.js is an amazing new addition to the React open-source ecosystem. It is “a minimalistic framework for universal server-rendered React applications” that makes the process of building these types of applications much faster and easier.&lt;br&gt;
If you haven’t already, get started by Signing Up for Cosmic JS. Helpful resources are provided below to streamline your development operations.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;CREATE A NEW BUCKET&lt;br&gt;
Your bucket’s name is the name of your website, project, client or web application that you are building.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;INSTALL THE NEXT.JS APP&lt;br&gt;
Once you’ve signed up and named your bucket, you’ll be prompted to start from scratch or “see some apps”. For this blog I simply clicked the right button to “see some apps” so that I could begin the installation process for the Next.js Website.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DEPLOY TO WEB&lt;br&gt;
I clicked “Deploy to Web”. I can then start editing my Global Objects, Object Types and Pages while my web application is deploying. You will receive an email confirming the deployment of your web application. If you encounter any issues during deployment, you may be routed to the Cosmic JS Troubleshooting Page.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;EDIT GLOBAL OBJECTS, OBJECT TYPES AND OBJECTS&lt;br&gt;
Editing is a dream come true in the Cosmic JS Dashboard. To read more about how Cosmic JS was built with editing content in mind, read Building With the Content Editor in Mind.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
  </channel>
</rss>
