<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>React on David Lang</title>
    <link>https://www.davidlang.tech/tags/react/</link>
    <description>Recent content in React on David Lang</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Mon, 10 Jun 2024 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.davidlang.tech/tags/react/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Next.js App Router: Complete Migration Guide</title>
      <link>https://www.davidlang.tech/posts/nextjs-app-router-complete-migration-guide/</link>
      <pubDate>Mon, 10 Jun 2024 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/nextjs-app-router-complete-migration-guide/</guid>
      <description>&lt;p&gt;Migrating from Pages Router to App Router unlocks RSC, layouts, and improved data fetching-but requires deliberate planning.&lt;/p&gt;&#xA;&lt;h2 id=&#34;folder-structure&#34;&gt;Folder Structure&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;app/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  layout.tsx      # Root layout&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  page.tsx        # /&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  blog/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [slug]/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      page.tsx    # /blog/:slug&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  api/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    hello/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      route.ts    # Route Handlers&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;data-fetching&#34;&gt;Data Fetching&lt;/h2&gt;&#xA;&lt;p&gt;Replace &lt;code&gt;getServerSideProps&lt;/code&gt; with async Server Components. Replace &lt;code&gt;getStaticProps&lt;/code&gt; with &lt;code&gt;fetch&lt;/code&gt; and &lt;code&gt;revalidate&lt;/code&gt; options. Client data still uses SWR or React Query in Client Components.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React Server Components: The Future of Data Fetching</title>
      <link>https://www.davidlang.tech/posts/react-server-components-the-future-of-data-fetching/</link>
      <pubDate>Sun, 20 Aug 2023 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/react-server-components-the-future-of-data-fetching/</guid>
      <description>&lt;p&gt;React Server Components (RSC) run on the server only-they never ship component logic to the client. That enables direct database access and smaller JavaScript bundles.&lt;/p&gt;&#xA;&lt;h2 id=&#34;server-vs-client-components&#34;&gt;Server vs Client Components&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#586e75&#34;&gt;// app/page.js - Server Component (default in App Router)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;async&lt;/span&gt; &lt;span style=&#34;color:#268bd2&#34;&gt;function&lt;/span&gt; ProductList() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#268bd2&#34;&gt;const&lt;/span&gt; products &lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#268bd2&#34;&gt;await&lt;/span&gt; db.products.findMany();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#719e07&#34;&gt;return&lt;/span&gt; (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#268bd2&#34;&gt;ul&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {products.map((p) =&amp;gt; &amp;lt;&lt;span style=&#34;color:#268bd2&#34;&gt;li&lt;/span&gt; key&lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt;{p.id}&amp;gt;{p.name}&amp;lt;/&lt;span style=&#34;color:#268bd2&#34;&gt;li&lt;/span&gt;&amp;gt;)}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#268bd2&#34;&gt;ul&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  );&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Add &lt;code&gt;&#39;use client&#39;&lt;/code&gt; only when you need hooks, event handlers, or browser APIs.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Store additional user information in firebase using react and javascript</title>
      <link>https://www.davidlang.tech/posts/store-additional-user-information-in-firebase-using-react-and-javascript/</link>
      <pubDate>Sun, 28 May 2023 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/store-additional-user-information-in-firebase-using-react-and-javascript/</guid>
      <description>&lt;p&gt;To store additional information for a user in &lt;code&gt;Firebase&lt;/code&gt; using React and JavaScript, you typically use Firestore or the Realtime Database, as Firebase Authentication does not allow for arbitrary additional data to be stored directly in user profiles. Here’s a step-by-step guide on how to achieve this using Firestore.&lt;/p&gt;&#xA;&lt;h2 id=&#34;step-1-set-up-firebase-in-your-react-app&#34;&gt;Step 1: Set Up Firebase in Your React App&lt;/h2&gt;&#xA;&lt;p&gt;First, ensure that you have Firebase set up in your React application. You need to install Firebase and initialize it in your project.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Simple Notes app using React, TypeScript, Node.js, GraphQL and MongoDB</title>
      <link>https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/</link>
      <pubDate>Mon, 17 Apr 2023 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/</guid>
      <description>&lt;p&gt;In the series of the blog post, I am going to walk through step by step process of building a &lt;a href=&#34;https://github.com/rasikjain/SimpleNotes&#34;&gt;Simple Notes&lt;/a&gt; App using &lt;a href=&#34;https://reactjs.org/&#34;&gt;React&lt;/a&gt;, &lt;a href=&#34;https://www.typescriptlang.org/&#34;&gt;TypeScript&lt;/a&gt;, &lt;a href=&#34;https://nodejs.org/en/&#34;&gt;Node.js&lt;/a&gt;, &lt;a href=&#34;https://graphql.org/&#34;&gt;GraphQL &lt;/a&gt;, and &lt;a href=&#34;https://www.mongodb.com/&#34;&gt;MongoDB&lt;/a&gt;. During the process of our development, we are going to use some useful npm packages like &lt;a href=&#34;https://expressjs.com/&#34;&gt;Express&lt;/a&gt;, &lt;a href=&#34;https://www.apollographql.com/docs/apollo-server&#34;&gt;Apollo-Server&lt;/a&gt;, &lt;a href=&#34;https://github.com/typegoose/typegoose&#34;&gt;Typegoose&lt;/a&gt;, &lt;a href=&#34;https://mongoosejs.com/&#34;&gt;Mongoose&lt;/a&gt;, &lt;a href=&#34;https://typegraphql.com/&#34;&gt;TypeGraphQL &lt;/a&gt;, and &lt;a href=&#34;https://getbootstrap.com/&#34;&gt;Bootstrap&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Here is the Github &lt;a href=&#34;https://github.com/rasikjain/SimpleNotes&#34;&gt;Source Code&lt;/a&gt; to run the application.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Table of Content&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#dev-environment-setup&#34;&gt;Dev Environment Setup&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#graphql-server-backend&#34;&gt;GraphQL Server Backend&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#folder-structure&#34;&gt;Folder Structure&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#creating-nodejs-project&#34;&gt;Creating Node.js project&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#configuring-typescript&#34;&gt;Configuring TypeScript&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#installing-dependency-packages&#34;&gt;Installing Dependency Packages&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#mongoose-schema-and-graphql-schema&#34;&gt;Mongoose Schema and GraphQL Schema&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#graphql-resolvers&#34;&gt;GraphQL Resolvers&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#mongo-database-setup&#34;&gt;Mongo Database Setup&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#environment-configuration&#34;&gt;Environment Configuration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#nodejs-server-setup&#34;&gt;Node.js Server Setup&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#config-files&#34;&gt;Config files&lt;/a&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#packagejson&#34;&gt;package.json&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#nodemonjson-configuration&#34;&gt;nodemon.json configuration&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.davidlang.tech/posts/simple-notes-app-using-react-typescript-nodejs-graphql-mongodb/#running-nodejs--server&#34;&gt;Running node.js / Server&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;dev-environment-setup&#34;&gt;Dev Environment Setup&lt;/h3&gt;&#xA;&lt;p&gt;We are going to set up our initial codebase and folder structure to get started. In this tutorial, I am going to use the Windows environment. The command structure is mostly the same and can be easily replicated to macOS.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Mastering Chart.js in React: A Comprehensive Guide with Examples</title>
      <link>https://www.davidlang.tech/posts/mastering-chartjs-in-react-a-comprehensive-guide-with-examples/</link>
      <pubDate>Thu, 24 Nov 2022 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/mastering-chartjs-in-react-a-comprehensive-guide-with-examples/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction:&lt;/h3&gt;&#xA;&lt;p&gt;In the world of web development, data visualization plays a crucial role in conveying information effectively. Chart.js, a popular JavaScript library, provides an elegant and flexible way to create interactive and visually appealing charts. In this blog post, we will explore how to integrate Chart.js into a React application and leverage its powerful features to create stunning charts. We&amp;rsquo;ll cover the installation process, basic usage, and provide practical examples to help you get started.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Differences between getServerSideProps and getStaticProps in Next.js</title>
      <link>https://www.davidlang.tech/posts/differences-between-getserversideprops-and-getstaticprops-in-next.js/</link>
      <pubDate>Tue, 11 Oct 2022 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/differences-between-getserversideprops-and-getstaticprops-in-next.js/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction:&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;Next.js&lt;/code&gt; is a popular &lt;code&gt;React framework&lt;/code&gt; that enables developers to create server-side rendered applications with ease. Two essential functions in Next.js are &lt;code&gt;getServerSideProps&lt;/code&gt; and &lt;code&gt;getStaticProps&lt;/code&gt;, which help developers pre-render pages and optimize performance. Although they share similarities, they have significant differences in terms of functionality and usage. In this blog, we will explore the differences between getServerSideProps and getStaticProps and provide real-world examples to help you understand their use cases.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Boosting Performance with useEffect: Best Use Cases and Examples</title>
      <link>https://www.davidlang.tech/posts/boosting-performance-with-useeffect-best-use-cases-and-examples/</link>
      <pubDate>Wed, 14 Sep 2022 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/boosting-performance-with-useeffect-best-use-cases-and-examples/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction:&lt;/h3&gt;&#xA;&lt;p&gt;As a React developer, you&amp;rsquo;re likely familiar with the &lt;code&gt;useEffect&lt;/code&gt; hook. It&amp;rsquo;s a powerful tool that allows you to manage side effects in functional components. While its primary role is to handle tasks like data fetching, DOM manipulation, and subscriptions, &lt;code&gt;useEffect&lt;/code&gt; can also be a game-changer when it comes to optimizing your application&amp;rsquo;s performance. In this blog post, we&amp;rsquo;ll explore some of the best use cases of &lt;code&gt;useEffect&lt;/code&gt; in improving performance, complete with sample code to help you get started.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Simplifying State Management with React&#39;s useContext Feature</title>
      <link>https://www.davidlang.tech/posts/simplifying-state-management-with-react-usecontext-feature/</link>
      <pubDate>Tue, 19 Jul 2022 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/simplifying-state-management-with-react-usecontext-feature/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction:&lt;/h3&gt;&#xA;&lt;p&gt;React, being a popular JavaScript library for building user interfaces, provides various tools and features to handle state management. One such feature is &lt;code&gt;useContext&lt;/code&gt;, which allows developers to share state across different components without prop drilling. In this blog post, we will explore the &lt;code&gt;useContext&lt;/code&gt; feature in React and demonstrate its usage with a TypeScript example.&lt;/p&gt;&#xA;&lt;h3 id=&#34;understanding-usecontext&#34;&gt;Understanding useContext:&lt;/h3&gt;&#xA;&lt;p&gt;The &lt;code&gt;useContext&lt;/code&gt; hook is part of the React library and allows components to consume values from a provided context. It provides a simple and efficient way to share state between multiple components in a React application. By utilizing &lt;code&gt;useContext&lt;/code&gt;, we can avoid passing props through intermediate components, thereby reducing the complexity of the codebase.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Efficient Data Flow in React: Unveiling the Power of Prop Drilling</title>
      <link>https://www.davidlang.tech/posts/efficient-data-flow-in-react-unveiling-the-power-of-prop-drilling/</link>
      <pubDate>Wed, 08 Jun 2022 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/efficient-data-flow-in-react-unveiling-the-power-of-prop-drilling/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction:&lt;/h3&gt;&#xA;&lt;p&gt;React, the popular JavaScript library for building user interfaces, offers several powerful features that make it a developer-friendly choice. One such feature is prop drilling, a technique used for passing data from a top-level component to a deeply nested component. In this blog post, we will explore the concept of prop drilling, understand its benefits and limitations, and provide an example using TypeScript to demonstrate its usage.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-is-prop-drilling&#34;&gt;What is Prop Drilling?&lt;/h3&gt;&#xA;&lt;p&gt;Prop drilling refers to the process of passing data through multiple layers of components in order to make it accessible to a deeply nested component that needs it. In React, components are organized in a hierarchical structure, where data typically flows from parent components to their children. However, when a component deeply nested in the component tree requires data from a top-level component, prop drilling comes into play.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Enhancing Web Performance with React&#39;s Lazy Loading Feature</title>
      <link>https://www.davidlang.tech/posts/enhancing-web-performance-with-react-lazy-loading-feature/</link>
      <pubDate>Fri, 22 Apr 2022 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/enhancing-web-performance-with-react-lazy-loading-feature/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction:&lt;/h3&gt;&#xA;&lt;p&gt;In today&amp;rsquo;s fast-paced digital world, website performance plays a vital role in providing a seamless user experience. As web applications become increasingly complex, it&amp;rsquo;s crucial to optimize the loading time of our applications. One powerful technique to achieve this is lazy loading. In this blog post, we&amp;rsquo;ll explore how React&amp;rsquo;s lazy loading feature can significantly improve web performance by deferring the loading of non-critical components until they are actually needed.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React 18: Concurrent Features and the New Root API</title>
      <link>https://www.davidlang.tech/posts/react-18-concurrent-features-and-the-new-root-api/</link>
      <pubDate>Sat, 15 Jan 2022 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/react-18-concurrent-features-and-the-new-root-api/</guid>
      <description>&lt;p&gt;React 18 introduced concurrent rendering, automatic batching, and a new root API. These changes improve perceived performance without rewriting your entire app.&lt;/p&gt;&#xA;&lt;h2 id=&#34;createroot&#34;&gt;createRoot&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;import&lt;/span&gt; { createRoot } from &lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;react-dom/client&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;import&lt;/span&gt; App from &lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;./App&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;const&lt;/span&gt; root &lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt; createRoot(&lt;span style=&#34;color:#b58900&#34;&gt;document&lt;/span&gt;.getElementById(&lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;root&amp;#39;&lt;/span&gt;));&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;root.render(&amp;lt;&lt;span style=&#34;color:#268bd2&#34;&gt;App&lt;/span&gt; /&amp;gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The legacy &lt;code&gt;ReactDOM.render&lt;/code&gt; is deprecated. &lt;code&gt;createRoot&lt;/code&gt; enables concurrent features.&lt;/p&gt;&#xA;&lt;h2 id=&#34;suspense-and-transitions&#34;&gt;Suspense and Transitions&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;useTransition&lt;/code&gt; marks updates as non-urgent-keeping the UI responsive during heavy re-renders:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;const&lt;/span&gt; [isPending, startTransition] &lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt; useTransition();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;function&lt;/span&gt; handleTab(tab) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  startTransition(() =&amp;gt; setActiveTab(tab));&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;strict-mode-changes&#34;&gt;Strict Mode Changes&lt;/h2&gt;&#xA;&lt;p&gt;Strict Mode double-invokes effects in development to surface side-effect bugs. Audit &lt;code&gt;useEffect&lt;/code&gt; cleanup functions before upgrading.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Testing React Components with Jest and RTL</title>
      <link>https://www.davidlang.tech/posts/testing-react-components-with-jest-and-rtl/</link>
      <pubDate>Thu, 15 Jul 2021 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/testing-react-components-with-jest-and-rtl/</guid>
      <description>&lt;p&gt;React Testing Library (RTL) encourages tests that resemble how users interact with your UI-queries by role, label, and text instead of implementation details.&lt;/p&gt;&#xA;&lt;h2 id=&#34;a-simple-component-test&#34;&gt;A Simple Component Test&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;import&lt;/span&gt; { render, screen, fireEvent } from &lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;@testing-library/react&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;import&lt;/span&gt; Counter from &lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;./Counter&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;test(&lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;increments count on click&amp;#39;&lt;/span&gt;, () =&amp;gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  render(&amp;lt;&lt;span style=&#34;color:#268bd2&#34;&gt;Counter&lt;/span&gt; /&amp;gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  fireEvent.click(screen.getByRole(&lt;span style=&#34;color:#2aa198&#34;&gt;&amp;#39;button&amp;#39;&lt;/span&gt;, { name&lt;span style=&#34;color:#719e07&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#dc322f&#34;&gt;/increment/i&lt;/span&gt; }));&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  expect(screen.getByText(&lt;span style=&#34;color:#dc322f&#34;&gt;/count: 1/i&lt;/span&gt;)).toBeInTheDocument();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;});&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;what-to-test&#34;&gt;What to Test&lt;/h2&gt;&#xA;&lt;p&gt;Focus on user-visible behavior: forms submit, errors display, loading states appear. Mock network with MSW (Mock Service Worker) instead of mocking fetch in every test.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Next.js: The Ultimate Guide to Server-Side Rendering</title>
      <link>https://www.davidlang.tech/posts/nextjs-the-ultimate-guide-to-server-side-rendering/</link>
      <pubDate>Wed, 20 Jan 2021 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/nextjs-the-ultimate-guide-to-server-side-rendering/</guid>
      <description>&lt;p&gt;Next.js extends React with file-based routing, SSR, SSG, and API routes. Understanding when each rendering mode applies is essential for performance and SEO.&lt;/p&gt;&#xA;&lt;h2 id=&#34;rendering-modes&#34;&gt;Rendering Modes&lt;/h2&gt;&#xA;&lt;p&gt;&lt;strong&gt;Static Generation (SSG)&lt;/strong&gt; pre-renders at build time-ideal for marketing pages and blogs. &lt;strong&gt;Server-Side Rendering (SSR)&lt;/strong&gt; renders on each request-best for personalized or frequently changing data. &lt;strong&gt;Client-Side Rendering (CSR)&lt;/strong&gt; hydrates in the browser for highly interactive dashboards.&lt;/p&gt;&#xA;&lt;h2 id=&#34;getserversideprops-example&#34;&gt;getServerSideProps Example&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-javascript&#34; data-lang=&#34;javascript&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#268bd2&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#268bd2&#34;&gt;async&lt;/span&gt; &lt;span style=&#34;color:#268bd2&#34;&gt;function&lt;/span&gt; getServerSideProps({ params }) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#268bd2&#34;&gt;const&lt;/span&gt; res &lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#268bd2&#34;&gt;await&lt;/span&gt; fetch(&lt;span style=&#34;color:#586e75&#34;&gt;`https://api.example.com/posts/&lt;/span&gt;&lt;span style=&#34;color:#2aa198&#34;&gt;${&lt;/span&gt;params.id&lt;span style=&#34;color:#2aa198&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#586e75&#34;&gt;`&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#268bd2&#34;&gt;const&lt;/span&gt; post &lt;span style=&#34;color:#719e07&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#268bd2&#34;&gt;await&lt;/span&gt; res.json();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#719e07&#34;&gt;return&lt;/span&gt; { props&lt;span style=&#34;color:#719e07&#34;&gt;:&lt;/span&gt; { post } };&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;app-router-preview&#34;&gt;App Router (Preview)&lt;/h2&gt;&#xA;&lt;p&gt;Next.js 13+ introduces the App Router with React Server Components. Pages Router patterns remain widely used-know both as you maintain legacy and greenfield apps.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Getting Started with React Hooks: A Complete Guide</title>
      <link>https://www.davidlang.tech/posts/getting-started-with-react-hooks-a-complete-guide/</link>
      <pubDate>Sat, 15 Feb 2020 00:00:00 +0000</pubDate>
      <guid>https://www.davidlang.tech/posts/getting-started-with-react-hooks-a-complete-guide/</guid>
      <description>&lt;p&gt;React Hooks arrived in React 16.8 and changed how we write components. Instead of class components for state and lifecycle logic, you can use functions with &lt;code&gt;useState&lt;/code&gt;, &lt;code&gt;useEffect&lt;/code&gt;, and more.&lt;/p&gt;&#xA;&lt;h2 id=&#34;why-hooks-matter&#34;&gt;Why Hooks Matter&lt;/h2&gt;&#xA;&lt;p&gt;Hooks let you reuse stateful logic without higher-order components or render props. They keep related logic together-fetching data, subscribing to events, and updating the DOM live in one place instead of spread across lifecycle methods.&lt;/p&gt;&#xA;&lt;h2 id=&#34;usestate-and-useeffect&#34;&gt;useState and useEffect&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;useState&lt;/code&gt; declares local state in a function component. &lt;code&gt;useEffect&lt;/code&gt; runs side effects after render-API calls, subscriptions, or DOM updates.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
