<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Untitled Publication]]></title><description><![CDATA[Untitled Publication]]></description><link>https://usamausman.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 01:21:36 GMT</lastBuildDate><atom:link href="https://usamausman.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Next JS and Tailwind CSS: A Powerful Combination for Web Development]]></title><description><![CDATA[Next JS and Tailwind CSS: A Powerful Combination for Web Development
In recent years, Next JS and Tailwind CSS have become two of the most popular tools for web development. Next JS is a powerful framework for building React-based applications, while...]]></description><link>https://usamausman.hashnode.dev/next-js-and-tailwind-css-a-powerful-combination-for-web-development</link><guid isPermaLink="true">https://usamausman.hashnode.dev/next-js-and-tailwind-css-a-powerful-combination-for-web-development</guid><category><![CDATA[Next.js]]></category><category><![CDATA[Tailwind CSS]]></category><category><![CDATA[full stack]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Usama Usman]]></dc:creator><pubDate>Sat, 22 Apr 2023 20:59:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1682196663696/54fab749-6eaf-4a81-adaf-0eed2b8c0ff0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Next JS and Tailwind CSS: A Powerful Combination for Web Development</p>
<p>In recent years, Next JS and Tailwind CSS have become two of the most popular tools for web development. Next JS is a powerful framework for building React-based applications, while Tailwind CSS is a utility-first CSS framework that allows you to rapidly prototype and build beautiful user interfaces.</p>
<p>What makes these two tools so powerful is that they work together seamlessly. In fact, Next JS has included Tailwind CSS in its TurboPack, which means you can configure Tailwind CSS right out of the box when you create a new Next JS app.</p>
<p>To create a new Next JS app with Tailwind CSS, you can simply run the following command:</p>
<pre><code class="lang-bash">npx create-next-app@latest
</code></pre>
<p>When you run this command, you'll be prompted to answer a few questions about how you want to set up your app. One of the questions will ask if you want to include Tailwind CSS. If you answer yes, Next JS will automatically configure Tailwind CSS for you and create the necessary files and folders. This makes it incredibly easy to get started with Next JS and Tailwind CSS.</p>
<p>The folder structure for the new app will look like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1682196963654/157d6600-6b7e-45bb-a460-1107ce6a32db.png" alt /></p>
<p>As you can see, there's a new <code>styles</code> folder in the root directory, which contains a <code>globals.css</code> file that you can use to apply global styles to your application. Additionally, there's a <code>tailwind.config.js</code> file in the root directory that you can use to configure Tailwind CSS.</p>
<p>But what exactly makes Tailwind CSS such a great choice for building user interfaces? For one, Tailwind CSS is highly customizable. It includes a wide range of pre-built utility classes that you can use to quickly style your UI, but you can also easily create your own custom classes to fit your specific needs.</p>
<p>Additionally, Tailwind CSS is designed to work well with modern web development tools like React and Next JS. Its utility-first approach makes it easy to build responsive and mobile-first designs, which are critical in today's mobile-first world.</p>
<p>Another benefit of using Tailwind CSS is that it can greatly improve your development speed. Because you don't have to write as much CSS code by hand, you can focus more on building your application's core functionality, which can save you time and reduce the risk of errors.</p>
<p>Finally, using Tailwind CSS can also improve the consistency and maintainability of your codebase. By relying on a set of pre-built utility classes, you can ensure that your UI elements are consistent throughout your application, which can make it easier to maintain and scale your codebase over time.</p>
<h2 id="heading-conclusion">Conclusion:</h2>
<p>Next JS and Tailwind CSS are a powerful combination for web development. With Tailwind CSS pre-configured in Next JS's TurboPack, you can quickly and easily start building beautiful and responsive user interfaces for your web applications. If you're not already using these tools, now is the time to give them a try and see how they can improve your development speed and code quality.</p>
]]></content:encoded></item><item><title><![CDATA[Understanding the "window is undefined" error in Next.js and how to resolve it]]></title><description><![CDATA[Next.js is a powerful React-based framework for building server-rendered or statically-generated web applications. However, sometimes, developers might face errors when using certain JavaScript methods that are specific to the client side, such as wi...]]></description><link>https://usamausman.hashnode.dev/understanding-the-window-is-undefined-error-in-nextjs-and-how-to-resolve-it</link><guid isPermaLink="true">https://usamausman.hashnode.dev/understanding-the-window-is-undefined-error-in-nextjs-and-how-to-resolve-it</guid><category><![CDATA[Next.js]]></category><category><![CDATA[Client-side rendering]]></category><category><![CDATA[Server side rendering]]></category><category><![CDATA[Window]]></category><category><![CDATA[sessionStorage]]></category><dc:creator><![CDATA[Usama Usman]]></dc:creator><pubDate>Fri, 10 Feb 2023 21:49:43 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1676065281842/f7720533-7e72-4ddf-9a55-ddb40af0d2df.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Next.js is a powerful React-based framework for building server-rendered or statically-generated web applications. However, sometimes, developers might face errors when using certain JavaScript methods that are specific to the client side, such as <code>window</code>, <code>sessionStorage</code>, and others. In this article, we'll explore the "window is undefined" error and how to resolve it using a simple check.</p>
<h2 id="heading-the-window-is-undefined-error"><strong>The "window is undefined" error</strong></h2>
<p>This error occurs when trying to access client-side methods on the server side during the initial render. As Next.js initially renders the application on the server side, these client-side methods are not available at that time, causing the application to break. To resolve this issue, the common solution is to make a check and only return the logic when the method is available.</p>
<p>Here's a solution through which we can get rid of this problem, we are using a conditional statement to check if <code>window</code> is defined. If it is, then we know that we are on the client side and can return the logic for the client side. If not, we return the logic for the server side.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-keyword">const</span> Home = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">if</span> (<span class="hljs-keyword">typeof</span> <span class="hljs-built_in">window</span> !== <span class="hljs-string">'undefined'</span>) {
    <span class="hljs-comment">// The code inside this block will only run on the client-side</span>
    <span class="hljs-keyword">return</span> (
      <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Welcome to the client-side<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Here, you have access to window and other client-side methods<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
    );
  }
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>Welcome to the server-side<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Here, you don't have access to window and other client-side methods<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Home;
</code></pre>
]]></content:encoded></item></channel></rss>