<?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: Endrit Gashi</title>
    <description>The latest articles on DEV Community by Endrit Gashi (@endritgashi).</description>
    <link>https://dev.to/endritgashi</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%2F629381%2F046446b3-884d-4b6e-93d1-f87f35170762.jpg</url>
      <title>DEV Community: Endrit Gashi</title>
      <link>https://dev.to/endritgashi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/endritgashi"/>
    <language>en</language>
    <item>
      <title>Lazy Loading in ReactJS: Improving User Experience and Performance</title>
      <dc:creator>Endrit Gashi</dc:creator>
      <pubDate>Fri, 03 Feb 2023 09:34:07 +0000</pubDate>
      <link>https://dev.to/endritgashi/lazy-loading-in-reactjs-improving-user-experience-and-performance-56o2</link>
      <guid>https://dev.to/endritgashi/lazy-loading-in-reactjs-improving-user-experience-and-performance-56o2</guid>
      <description>&lt;p&gt;Lazy loading is a technique in web development that delays the loading of certain elements on a page until they are needed. This can significantly improve the initial loading time of a web page and provide a better user experience. In ReactJS, lazy loading can be achieved through the use of the "lazy" function from the "react" package.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Lazy Loading is Important&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In today's fast-paced world, users expect websites to load quickly. If a website takes too long to load, users are likely to leave and never come back. Lazy loading can help to reduce the initial loading time of a web page by only loading the elements that are necessary for the user to see. This can result in a faster, more responsive website and a better user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Implement Lazy Loading in ReactJS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Implementing lazy loading in ReactJS is a simple process. The "lazy" function is used to delay the loading of a component until it is needed. The "lazy" function takes a function as an argument that returns the component to be loaded.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is an example of lazy loading in ReactJS:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { lazy, Suspense } from 'react';

const MyComponent = lazy(() =&amp;gt; import('./MyComponent'));

function App() {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;Suspense fallback={&amp;lt;div&amp;gt;Loading...&amp;lt;/div&amp;gt;}&amp;gt;
        &amp;lt;MyComponent /&amp;gt;
      &amp;lt;/Suspense&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;In this example, the "MyComponent" component is loaded lazily using the "lazy" function. The "Suspense" component is used to provide a fallback UI while the component is loading.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>ethereum</category>
      <category>web3</category>
      <category>cryptocurrency</category>
    </item>
    <item>
      <title>How to Implement a Sitemap in Next.js for Better SEO</title>
      <dc:creator>Endrit Gashi</dc:creator>
      <pubDate>Fri, 03 Feb 2023 09:20:55 +0000</pubDate>
      <link>https://dev.to/endritgashi/how-to-implement-a-sitemap-in-nextjs-for-better-seo-ai6</link>
      <guid>https://dev.to/endritgashi/how-to-implement-a-sitemap-in-nextjs-for-better-seo-ai6</guid>
      <description>&lt;p&gt;Next.js is a popular React-based framework for building server-side rendered (SSR) and statically generated websites. One important aspect of optimizing a website for search engines is to have a well-structured sitemap. In this blog post, we'll go over how to implement a sitemap in Next.js for better SEO.&lt;/p&gt;

&lt;p&gt;What is a Sitemap?&lt;br&gt;
A sitemap is a file that lists all the pages of your website. It is submitted to search engines such as Google and Bing to help them crawl and index your site more efficiently. A sitemap also provides important information about each page, such as when it was last updated and how often it changes.&lt;/p&gt;

&lt;p&gt;Implementing a Sitemap in Next.js&lt;br&gt;
There are several packages available for generating sitemaps in Next.js, but we'll be using the next-sitemap package. Here's how to set it up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the package
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install next-sitemap

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Create a sitemap.js file in your Next.js project's root directory.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Sitemap from 'next-sitemap';

export default new Sitemap()
    .add({ url: '/', changefreq: 'daily', priority: 1.0 })
    .build('https://www.example.com');


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add a script to generate the sitemap.xml file in your package.json file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
  "generate-sitemap": "node sitemap.js"
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Run the script to generate the sitemap.xml file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run generate-sitemap

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Submit the sitemap.xml file to search engines. You can do this through Google Search Console and Bing Webmaster Tools.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>gratitude</category>
    </item>
  </channel>
</rss>
