<?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: Code Rifki</title>
    <description>The latest articles on DEV Community by Code Rifki (@coderifki).</description>
    <link>https://dev.to/coderifki</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2628893%2F7da15f50-fe99-44ab-980c-546bab5b6acd.png</url>
      <title>DEV Community: Code Rifki</title>
      <link>https://dev.to/coderifki</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/coderifki"/>
    <language>en</language>
    <item>
      <title>REST API vs GraphQL: What's the Difference?</title>
      <dc:creator>Code Rifki</dc:creator>
      <pubDate>Sat, 03 Oct 2026 05:33:38 +0000</pubDate>
      <link>https://dev.to/coderifki/rest-api-vs-graphql-whats-the-difference-5gkf</link>
      <guid>https://dev.to/coderifki/rest-api-vs-graphql-whats-the-difference-5gkf</guid>
      <description>&lt;h2&gt;
  
  
  What Is REST API?
&lt;/h2&gt;

&lt;p&gt;REST API is a popular approach for building communication between applications. It uses HTTP methods such as &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, and &lt;code&gt;DELETE&lt;/code&gt;to work with resources.&lt;/p&gt;

&lt;p&gt;For example, an endpoint like &lt;code&gt;/api/products&lt;/code&gt; might return a list of products. REST is straightforward, widely supported, and relatively easy for beginners to understand.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What Is GraphQL?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;**GraphQL **is an API query language that lets clients request exactly the data they need. Instead of calling multiple endpoints, a client can often use a single GraphQL endpoint and specify the required fields.&lt;/p&gt;

&lt;p&gt;This can be useful for applications with complex data requirements, especially when different screens need different combinations of information.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;REST vs GraphQL: Which Should You Use?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;REST can be a practical choice for simple APIs, traditional CRUD applications, and systems with clearly defined resources. GraphQL can be useful when clients need flexible queries or when data comes from multiple related resources.&lt;/p&gt;

&lt;p&gt;Neither approach is universally better. The right choice depends on your application's requirements, team experience, and API architecture.&lt;/p&gt;

&lt;h3&gt;
  
  
  FAQs
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Is GraphQL faster than REST?&lt;/strong&gt;&lt;br&gt;
Not necessarily. Performance depends on factors such as database queries, caching, network requests, and server implementation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can REST and GraphQL be used together?&lt;/strong&gt;&lt;br&gt;
Yes. An application can use REST for some services while using GraphQL for other parts of its architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The difference between &lt;strong&gt;REST API&lt;/strong&gt; and &lt;strong&gt;GraphQL&lt;/strong&gt; mainly comes down to how clients request and receive data. REST uses resource-based endpoints, while GraphQL allows clients to define the data they need. Choose the approach that fits your application's complexity, data requirements, and development workflow.&lt;/p&gt;

</description>
      <category>restapi</category>
      <category>programming</category>
      <category>graphql</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Common Next.js Mistakes Beginners Make (and How to Avoid Them)</title>
      <dc:creator>Code Rifki</dc:creator>
      <pubDate>Sat, 03 Oct 2026 04:52:52 +0000</pubDate>
      <link>https://dev.to/coderifki/common-nextjs-mistakes-beginners-make-and-how-to-avoid-them-5fn3</link>
      <guid>https://dev.to/coderifki/common-nextjs-mistakes-beginners-make-and-how-to-avoid-them-5fn3</guid>
      <description>&lt;h3&gt;
  
  
  1. Using "use client" Everywhere
&lt;/h3&gt;

&lt;p&gt;One common mistake beginners make in Next.js is adding &lt;code&gt;"use client"&lt;/code&gt; to almost every component. While Client Components are useful for interactivity, unnecessary usage can increase the amount of JavaScript sent to the browser.&lt;/p&gt;

&lt;p&gt;Start with Server Components and use &lt;code&gt;"use client"&lt;/code&gt; only when you need browser-side features such as state, event handlers, or effects.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Ignoring Next.js Image Optimization
&lt;/h3&gt;

&lt;p&gt;Using regular &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; elements everywhere can mean missing out on features provided by the Next.js &lt;code&gt;Image&lt;/code&gt; component. For many projects, &lt;code&gt;next/image&lt;/code&gt; can help optimize image loading and improve performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Fetching Data in the Wrong Place
&lt;/h3&gt;

&lt;p&gt;Beginners sometimes fetch data inside Client Components when the data could be retrieved on the server. With the App Router, consider fetching data in Server Components when client-side interaction isn't required.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Creating Huge Components
&lt;/h3&gt;

&lt;p&gt;Putting an entire page into one massive component makes your code difficult to maintain. Break reusable sections into smaller components with clear responsibilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQs
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Should beginners always use Server Components?&lt;/strong&gt;&lt;br&gt;
Not always. Use Server Components by default, then switch to Client Components when interactive browser functionality is needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is &lt;code&gt;"use client"&lt;/code&gt; bad?&lt;/strong&gt;&lt;br&gt;
No. It is an important Next.js feature. The problem is using it when the component doesn't actually need client-side functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Avoiding common Next.js mistakes can make your applications easier to maintain and improve performance. Focus on understanding Server and Client Components, data fetching, image optimization, and component structure. Start applying these practices to your next Next.js project and build better habits from the beginning.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>nextjs</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Understanding the Next.js App Router in 5 Minutes</title>
      <dc:creator>Code Rifki</dc:creator>
      <pubDate>Sat, 03 Oct 2026 04:33:50 +0000</pubDate>
      <link>https://dev.to/coderifki/understanding-the-nextjs-app-router-in-5-minutes-cgc</link>
      <guid>https://dev.to/coderifki/understanding-the-nextjs-app-router-in-5-minutes-cgc</guid>
      <description>&lt;h2&gt;
  
  
  What Is the Next.js App Router?
&lt;/h2&gt;

&lt;p&gt;The Next.js App Router is the modern routing system introduced in Next.js, built around React Server Components. Instead of keeping all routes in one configuration file, you create routes using folders and special files inside the &lt;code&gt;app&lt;/code&gt;directory.&lt;/p&gt;

&lt;p&gt;For example, &lt;code&gt;app/about/page.tsx&lt;/code&gt; automatically creates the &lt;code&gt;/about&lt;/code&gt; route. Simple, right?&lt;/p&gt;

&lt;p&gt;The App Router also provides built-in support for layouts, loading states, error handling, and dynamic routes, making it easier to organize larger applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Does the App Router Work?
&lt;/h3&gt;

&lt;p&gt;The basic structure is straightforward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;app/page.tsx&lt;/code&gt; → Homepage&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app/about/page.tsx&lt;/code&gt; → About page&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app/blog/[slug]/page.tsx&lt;/code&gt; → Dynamic blog page&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app/layout.tsx&lt;/code&gt; → Shared layout&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By default, components inside the App Router are Server Components. You can use "use client" when a component needs browser-side interactivity, such as state or event handlers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The Next.js App Router gives you a structured way to build modern React applications with routing, layouts, data fetching, and Server Components. Start with the app directory and learn its core files first. Build a small project and experiment with nested and dynamic routes to get comfortable quickly.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>approuter</category>
      <category>programming</category>
    </item>
    <item>
      <title>Server Components vs Client Components: When to Use Which</title>
      <dc:creator>Code Rifki</dc:creator>
      <pubDate>Fri, 02 Oct 2026 12:36:27 +0000</pubDate>
      <link>https://dev.to/coderifki/server-components-vs-client-components-when-to-use-which-2154</link>
      <guid>https://dev.to/coderifki/server-components-vs-client-components-when-to-use-which-2154</guid>
      <description>&lt;h2&gt;
  
  
  Understanding Server and Client Components
&lt;/h2&gt;

&lt;p&gt;If you're building with Next.js, you’ll quickly encounter Server Components and Client Components. But which one should you use?&lt;/p&gt;

&lt;p&gt;Server Components run on the server and are ideal for fetching data, accessing databases, and keeping sensitive logic away from the browser. They can also help reduce the amount of JavaScript sent to users.&lt;/p&gt;

&lt;p&gt;Client Components, marked with &lt;code&gt;use client&lt;/code&gt;, run in the browser. Use them when your component needs interactivity, such as state, event handlers, forms, or browser APIs.&lt;/p&gt;

&lt;p&gt;Think of Server Components as your application's backend kitchen, while Client Components are the part customers interact with directly.&lt;/p&gt;

&lt;h3&gt;
  
  
  When Should You Use Each?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Choose Server Components&lt;/strong&gt; for static content, data fetching, authentication checks, and database operations. Choose Client Components for interactive UI elements like dropdowns, modals, counters, and dynamic forms.&lt;/p&gt;

&lt;h3&gt;
  
  
  FAQs
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Can Server Components use &lt;code&gt;"useState"&lt;/code&gt;?&lt;/strong&gt;&lt;br&gt;
No. React hooks that require browser-side interaction, such as &lt;code&gt;useState&lt;/code&gt;and &lt;code&gt;useEffect&lt;/code&gt;, belong in Client Components.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should every component use &lt;code&gt;"use client"&lt;/code&gt;?&lt;/strong&gt;&lt;br&gt;
No. Add it only where client-side functionality is actually required.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>ssr</category>
      <category>csr</category>
    </item>
    <item>
      <title>The Difference Between SPA and PWA</title>
      <dc:creator>Code Rifki</dc:creator>
      <pubDate>Fri, 02 Oct 2026 12:06:24 +0000</pubDate>
      <link>https://dev.to/coderifki/the-difference-between-spa-and-pwa-3mnf</link>
      <guid>https://dev.to/coderifki/the-difference-between-spa-and-pwa-3mnf</guid>
      <description>&lt;p&gt;When building modern web applications, you may come across the terms SPA (Single Page Application) and PWA (Progressive Web App). Although they are often mentioned together, they are actually different concepts.&lt;/p&gt;

&lt;p&gt;A SPA focuses on how an application works, while a PWA focuses on improving the web experience with features such as offline support, installation, and caching.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a SPA?
&lt;/h2&gt;

&lt;p&gt;A Single Page Application (SPA) is a web application that loads a main page and dynamically updates its content without requiring a full page reload.&lt;/p&gt;

&lt;p&gt;Frameworks and libraries such as React, Vue, and Angular are commonly used to build SPAs.&lt;/p&gt;

&lt;p&gt;For example, when a user moves from a dashboard to a settings page, a SPA can update the interface without completely reloading the browser.&lt;/p&gt;

&lt;p&gt;This can make applications feel faster and smoother, especially for interactive applications such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Admin dashboards&lt;/li&gt;
&lt;li&gt;SaaS applications&lt;/li&gt;
&lt;li&gt;Project management tools&lt;/li&gt;
&lt;li&gt;Web-based applications&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Is a PWA?
&lt;/h2&gt;

&lt;p&gt;A Progressive Web App (PWA) is a web application that uses modern browser features to provide a more app-like experience.&lt;/p&gt;

&lt;p&gt;A PWA can provide features such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Offline support&lt;/li&gt;
&lt;li&gt;Installability&lt;/li&gt;
&lt;li&gt;Caching&lt;/li&gt;
&lt;li&gt;Push notifications&lt;/li&gt;
&lt;li&gt;App-like navigation and behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PWAs commonly use technologies such as service workers and a web app manifest.&lt;/p&gt;

&lt;p&gt;Unlike a native mobile application, users can access a PWA directly through a web browser.&lt;/p&gt;

&lt;p&gt;A SPA does not automatically become a PWA.&lt;/p&gt;

&lt;p&gt;Likewise, a PWA does not have to be a SPA.&lt;/p&gt;

&lt;p&gt;However, developers can combine both approaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The difference between SPA and PWA is mainly about their purpose. A SPA focuses on application architecture and dynamic navigation, while a PWA focuses on enhancing a web application with modern browser capabilities.&lt;/p&gt;

&lt;p&gt;They are not competing technologies. A single web application can be both a SPA and a PWA, depending on its requirements.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Variables in TypeScript</title>
      <dc:creator>Code Rifki</dc:creator>
      <pubDate>Thu, 10 Sep 2026 08:08:50 +0000</pubDate>
      <link>https://dev.to/coderifki/variables-in-typescript-4hj7</link>
      <guid>https://dev.to/coderifki/variables-in-typescript-4hj7</guid>
      <description>&lt;p&gt;Variables are one of the most basic building blocks of any TypeScript program. They allow you to store information such as names, numbers, user data, and application settings. If you're familiar with JavaScript, you'll find TypeScript variables very familiar, but TypeScript gives you an extra layer of type safety.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Declare Variables in TypeScript
&lt;/h2&gt;

&lt;p&gt;TypeScript uses the same let, const, and var keywords as JavaScript. However, you can specify the expected data type using a colon (:).&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;John&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;age&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;isActive&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;username&lt;/code&gt; must contain a string, &lt;code&gt;age&lt;/code&gt; must contain a number, and &lt;code&gt;isActive&lt;/code&gt; must contain a boolean value. If you accidentally assign the wrong type, TypeScript can warn you before the application runs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Using &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In modern TypeScript development, &lt;code&gt;let&lt;/code&gt; and &lt;code&gt;const&lt;/code&gt; are generally preferred over &lt;code&gt;var&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Use &lt;code&gt;let&lt;/code&gt; when the value needs to change:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;score&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use &lt;code&gt;const&lt;/code&gt; when the value should not be reassigned:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;website&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;My Website&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>typescript</category>
    </item>
    <item>
      <title>What Is TypeScript?</title>
      <dc:creator>Code Rifki</dc:creator>
      <pubDate>Thu, 10 Sep 2026 08:02:32 +0000</pubDate>
      <link>https://dev.to/coderifki/what-is-typescript-39kk</link>
      <guid>https://dev.to/coderifki/what-is-typescript-39kk</guid>
      <description>&lt;p&gt;TypeScript is a programming language developed by Microsoft that builds on JavaScript by adding static typing and other development features. Think of it as JavaScript with an extra safety net, it helps developers catch potential errors before their code runs.&lt;/p&gt;

&lt;p&gt;Unlike JavaScript, TypeScript allows you to define the type of data a variable, function, or object should contain. This can make large applications easier to maintain, especially when multiple developers are working on the same project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Should You Use TypeScript?
&lt;/h2&gt;

&lt;p&gt;One of the biggest advantages of TypeScript is improved code reliability. Your editor can detect many mistakes while you're writing code, saving you from discovering them later in the browser.&lt;/p&gt;

&lt;p&gt;TypeScript also provides better autocomplete, clearer documentation, and easier refactoring. It works especially well with modern frameworks such as React, Next.js, and Node.js.&lt;/p&gt;

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