<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ update  - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ update  - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Mon, 25 May 2026 15:48:47 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/update/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ What's New in macOS? How to Install the Sequoia Beta ]]>
                </title>
                <description>
                    <![CDATA[ The macOS Sequoia public beta is now available. Though the final release of macOS Sequoia (macOS 15) won't be available until late September or early October 2024, I'll show you how to install the public beta for an advance look. It's actually stable... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/whats-new-in-macos-how-to-install-the-sequoia-beta/</link>
                <guid isPermaLink="false">66ba160b1f44b55a20d330e0</guid>
                
                    <category>
                        <![CDATA[ macOS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ update  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Daniel Kehoe ]]>
                </dc:creator>
                <pubDate>Tue, 30 Jul 2024 14:55:13 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/07/sequoia-desktop-1058w.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>The macOS Sequoia public beta is now available.</p>
<p>Though the final release of macOS Sequoia (macOS 15) won't be available until late September or early October 2024, I'll show you how to install the public beta for an advance look. It's actually stable enough for daily use.</p>
<p>The macOS Sequoia public beta is available to anyone who wants to try it, though you have to register with the <a target="_blank" href="https://beta.apple.com/">Apple Beta Software Program</a> to obtain it.</p>
<h2 id="heading-table-of-contents">Table of Contents</h2>
<ol>
<li><a class="post-section-overview" href="#heading-is-macos-sequoia-stable">Is macOS Sequoia stable?</a></li>
<li><a class="post-section-overview" href="#heading-time-needed-to-install">Time needed to install</a></li>
<li><a class="post-section-overview" href="#whats-new-in-macos-sequoia">What's new in macOS Sequoia</a></li>
<li><a class="post-section-overview" href="#new-features-in-macos-sequoia">Features in macOS Sequoia</a></li>
<li><a class="post-section-overview" href="#heading-small-changes-in-macos-sequoia">Small changes in macOS Sequoia</a></li>
<li><a class="post-section-overview" href="#heading-requirements-for-macos-sequoia">Requirements for macOS Sequoia</a></li>
<li><a class="post-section-overview" href="#back-up-your-mac-first">Back up your Mac first</a></li>
<li><a class="post-section-overview" href="#heading-sign-up-to-get-the-public-beta">Sign up to get the public beta</a></li>
<li><a class="post-section-overview" href="#heading-where-to-install-the-macos-beta">Where to install the macOS beta</a><br>– <a class="post-section-overview" href="#heading-install-on-a-spare-mac">Install on a spare Mac</a><br>– <a class="post-section-overview" href="#heading-install-on-an-external-drive">Install on an external drive</a><br>– <a class="post-section-overview" href="#heading-install-on-a-separate-volume">Install on a separate volume</a></li>
<li><a class="post-section-overview" href="#heading-use-the-startup-manager">Use the Startup Manager</a></li>
<li><a class="post-section-overview" href="#heading-halt-macos-beta-updates">Halt macOS beta updates</a></li>
<li><a class="post-section-overview" href="#heading-return-to-macos-sonoma">Return to macOS Sonoma</a></li>
<li><a class="post-section-overview" href="#whats-next">What's next</a></li>
</ol>
<h2 id="heading-is-macos-sequoia-stable">Is macOS Sequoia Stable?</h2>
<p>So far, users are reporting the beta version has only a few minor issues. They say the beta is "surprisingly stable." </p>
<p>There are reports of issues with external monitors, and users say to expect issues with external third-party devices. There may also be issues with screen sharing, video conferencing (Zoom particularly), or streaming in web browsers.</p>
<h2 id="heading-time-needed-to-install">Time Needed to Install</h2>
<p>The update from macOS Sonoma to macOS Sequoia can take more than an hour. The time needed varies widely based on factors such as the size of the update, your Internet speed, and the age and performance of your Mac.</p>
<h2 id="heading-whats-new-in-macos-sequoia">What's New in macOS Sequoia</h2>
<p>Users are reporting that macOS Sequoia is faster, with better battery life on laptops, but we can't be sure until we see the final release.</p>
<p>Looking closely at <a target="_blank" href="https://mac.install.guide/macos/sequoia">macOS Sequoia</a>, it's plain that it isn't a major overhaul of the operating system. The most useful features are Window Tiling and a new Passwords application, as well as iPhone mirroring and seamless drag and drop between devices.</p>
<p>I've compared <a target="_blank" href="https://mac.install.guide/macos/sonoma-vs-sequoia">Sonoma vs Sequoia</a> in a separate article, and also provided some advice to answer the question, <a target="_blank" href="https://mac.install.guide/macos/should-i-update">Should You Update to macOS Sequoia?</a></p>
<h2 id="heading-features-in-macos-sequoia">Features in macOS Sequoia</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/mac-passwords-app.png" alt="Image" width="600" height="400" loading="lazy">
<em>macOS Sequoia Passwords application</em></p>
<h3 id="heading-password-manager">Password Manager</h3>
<p>MacOS Sequoia adds a new app called Passwords, improving the way users manage their login credentials. </p>
<p>Built on the existing framework of Apple's Keychain, this app consolidates passwords, passkeys, Wi-Fi passwords, and other essential credentials into one secure, centralized location. </p>
<p>Credentials previously could be edited in System Settings but they were buried and hard to find. The new Passwords app will largely eliminate the need to use third-party password managers such as 1Password, LastPass, or Bitwarden.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/mac-sequoia-tiling.png" alt="Image" width="600" height="400" loading="lazy">
<em>macOS Sequoia Window Tiling</em></p>
<h3 id="heading-window-tiling">Window Tiling</h3>
<p>For years, Windows users have complained that MacOS lacks a tiling window manager. MacOS Sequoia adds a new feature called Window Tiling, which allows users to drag windows to the edge of the screen for placement side by side, top and bottom, or in a grid. Third-party utilities have more features but the built-in Window Tiling is a welcome addition.</p>
<p>These two features make an upgrade worthwhile. In addition, Apple has announced other capabilities.</p>
<h3 id="heading-iphone-mirroring">iPhone Mirroring</h3>
<p>This feature allows the use of iPhone apps within a macOS window. Users can now check iPhone notifications directly on their Mac, making the Mac an extension of the iPhone. </p>
<p>One user noted, “No longer do I have to find my phone when I am at home sitting in front of my Mac just to check on a notification.”</p>
<h3 id="heading-seamless-drag-and-drop-between-devices">Seamless Drag and Drop Between Devices</h3>
<p>This feature aims to improve the reliability of transferring files between iPhone and Mac, addressing issues with AirDrop. "Transferring files from Mac to an iPhone Apps no longer requires 5+ tedious steps," a user mentioned.</p>
<h3 id="heading-apple-intelligence">Apple Intelligence</h3>
<p>MacOS Sequoia will introduce the first use of Apple Intelligence, Apple's AI initiative. Apple Intelligence comprises new system-level capabilities, leveraging Apple custom silicon for both local and cloud-based processing. </p>
<p>This is more of a future prospect as AI gets baked in to more applications, but we may see improvements to Siri in macOS Sequoia. Note that these capabilities won't be present when you install macOS Sequoia on an Intel-based Mac.</p>
<h2 id="heading-small-changes-in-macos-sequoia">Small Changes in macOS Sequoia</h2>
<ul>
<li><strong>System Settings:</strong> Individual menus have been rearranged for quicker access to frequently used menus.</li>
<li><strong>Safari:</strong> The web browser has faster page load times, a new start page, and a brand new unified menu similar to "compact mode" on iOS. It can summarize websites and highlight relevant information.</li>
<li><strong>Notes:</strong> Minor improvements including collapsible sections and a choice of highlight styles. Also, Notes adds support for live audio transcription and math equations.</li>
<li><strong>Videoconferencing:</strong> Preview what you share in video calls for presentations and screen sharing. Also, background replacements are built into the macOS video feed so you won't need to use background replacements in Zoom or other conferencing apps.</li>
</ul>
<h2 id="heading-requirements-for-macos-sequoia">Requirements for macOS Sequoia</h2>
<p><a target="_blank" href="https://mac.install.guide/macos/check-version">Check your macOS version</a> and <a target="_blank" href="https://mac.install.guide/macos/update">update macOS</a> to Sonoma (macOS 14) before installing the macOS Sequoia beta.</p>
<p>You should keep the current macOS Sonoma available on your Mac, just in case you run into problems with the beta. That means you should install the macOS Sequoia beta on a separate volume, external drive, or a secondary Mac. </p>
<p>Also, macOS Sequoia does run on older Intel-based Macs, but it may be slow. So I recommend installing it only on Macs with M1, M2, or M3, the Apple Silicon chips.</p>
<p>You can install the macOS Sequoia beta on any computer that runs runs macOS Sonoma with the exception of the 2018–2019 MacBook Air models with Intel Amber Lake chips. Apple provides a <a target="_blank" href="https://www.apple.com/macos/macos-sequoia-preview/">list of supported models for macOS Sequoia</a>.</p>
<h2 id="heading-back-up-your-mac">Back Up Your Mac</h2>
<p>If you've got a new Mac that hasn't been used, you don't need to back up files. Or, if you're like many developers, you won't need to back up your Mac if you have all your important files stored in the cloud. </p>
<p>Otherwise, if there are important files on your computer, make sure you have a backup of your Mac before you install the macOS beta version.</p>
<h2 id="heading-sign-up-to-get-the-public-beta">Sign Up to Get the Public Beta</h2>
<p>Apple offers a public beta version as well as developer beta versions. The developer beta is released first and intended for software developers to test compatibility of applications, while the public beta is released a few weeks later. The public beta is more stable and has fewer bugs than the developer beta.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/07/apple-beta-program.png" alt="macOS Sequoia Public Beta" width="600" height="400" loading="lazy"></p>
<p>The public beta is available now, for free. Sign up for the public beta on the <a target="_blank" href="https://beta.apple.com/">Apple Beta Software Program</a> website. After you sign up with your Apple ID, your System Settings will show that beta updates are available.</p>
<h2 id="heading-where-to-install-the-macos-beta">Where to Install the macOS Beta</h2>
<p>Your best option is to install the macOS beta on a spare Mac, if you have an extra computer. Ideally, you have a relatively new Mac with an Apple Silicon M1, M2, or M3 chip. If you have an older Mac, you may want to avoid the beta version because it could slow down your computer. </p>
<p>Installing on a spare Mac allows you to try the new macOS version without affecting your daily productivity.</p>
<p>Alternatively, you can install the macOS beta on a separate volume on your Mac. This allows you to boot into the beta version when you want to try it out. </p>
<p>You can also install the beta version on an external drive. In either case, you need to hold the power button until you see the Startup Manager menu which lets you select an alternate to the default startup disk.</p>
<p>Here are instructions for installing the macOS Sequoia beta version on a spare Mac, an external drive, or a separate volume.</p>
<h3 id="heading-install-on-a-spare-mac">Install on a spare Mac</h3>
<p>Here's how to install the macOS Sequoia beta on a Mac running macOS Sonoma.</p>
<ol>
<li>Open <code>System Settings</code> and navigate to <code>General</code> and <code>Software Update</code>.</li>
<li>Click the "circle I" info button in <code>Beta Updates</code>.</li>
<li>Set the <code>Beta Updates</code> to <code>macOS Sequoia Public Beta</code>.</li>
<li>Click "Done" and your Mac will check for software updates.</li>
<li>After a check, the upgrade name appears with an "Upgrade Now" button.</li>
<li>Software updates require at least 20% battery power so you may need to connect to power if your battery is low.</li>
<li>Enter your password to start the software update. With a fast Internet connection, the download should take about 30 minutes. After the download, the "preparing" process will take about 15 minutes.</li>
<li>Your Mac will restart after the installation. You'll see the Apple logo and a progress bar. The installation process will take about 15 minutes with several automatic restarts.</li>
<li>After installation completes, you'll see the login screen. Enter your Mac password, then your Apple ID password, and "Continue" or "Set Up Later" through various agreements and settings.</li>
<li>The macOS Sequoia desktop will appear with a the Feedback Assistant application open. Use the Feedback Assistant to report any bugs or issues you encounter.</li>
<li>Check <code>About This Mac</code> to confirm you're running macOS 15.</li>
</ol>
<p>If you don't see <code>macOS Sequoia Public Beta</code> option in <code>Beta Updates</code>, sign up for the <a target="_blank" href="https://beta.apple.com/">Apple Beta Software Program</a>. After you sign up with your Apple ID, your System Settings will show that beta updates are available.</p>
<h3 id="heading-install-on-an-external-drive">Install on an external drive</h3>
<p>Not many users own an external drive now that cloud storage is popular. But if you have an external drive, you can install the macOS beta on it. </p>
<p>You'll need to format the drive so you must erase any files already on the drive. It's best if you own a fast SSD drive with a USB-C or Thunderbolt connection for use of the operating system. You can use a USB thumb drive, but you'll need at least 32 GB of space.</p>
<h4 id="heading-how-to-format-the-external-drive">How to format the external drive</h4>
<ol>
<li>Connect the external drive to your Mac.</li>
<li>Search in Spotlight and open <code>Disk Utility</code>.</li>
<li>Select the external drive in the left sidebar.</li>
<li>Click <code>Erase</code> to reformat the drive.</li>
<li>Name the drive <code>macOS Sequoia</code> or whatever you like.</li>
<li>Choose <code>Mac OS Extended (Journaled)</code> as the format.</li>
<li>Choose <code>GUID Partition Map</code> as the scheme.</li>
<li>Click <code>Erase</code> to format the drive.</li>
<li>Close <code>Disk Utility</code> after the drive formatting is done.</li>
</ol>
<h4 id="heading-how-to-get-the-macos-sequoia-beta">How to get the macOS Sequoia beta</h4>
<p>You'll need to download <code>*.pkg</code> files to install on an external drive. Several sites provide links to installer <code>*.pkg</code> files for macOS betas. Check:</p>
<ul>
<li><a target="_blank" href="https://betaprofiles.dev/install/macos-15/">betaprofiles.dev</a></li>
<li><a target="_blank" href="https://mrmacintosh.com/macos-sequoia-full-installer-database-download-directly-from-apple/">mrmacintosh.com</a></li>
</ul>
<p>Download the latest <code>InstallAssistant.pkg</code>. These files are huge (14GB or more) so a download may take more than 30 minutes with a fast Internet connection.</p>
<h4 id="heading-how-to-install-the-macos-sequoia-beta">How to install the macOS Sequoia beta</h4>
<p>Double click the <code>InstallAssistant.pkg</code> file to start the installation. Click "Change Install Location" to select the external drive. In the step "Destination Select" you can select the external drive as the installation destination.</p>
<h3 id="heading-install-on-a-separate-volume">Install on a separate volume</h3>
<p>If you want to install the macOS beta on a separate volume, follow these steps. You might hear this process called a "dual boot" or "separate partition" installation. Apple's APFS file system introduced "volumes" which are like partitions but more flexible. </p>
<p>You'll have two volumes on your Mac, one for macOS Sonoma and one for macOS Sequoia. You can use the Startup Manager to choose which volume to boot from.</p>
<h4 id="heading-how-to-create-a-new-volume">How to create a new volume</h4>
<ol>
<li>Search in Spotlight and open <code>Disk Utility</code>.</li>
<li>Select the internal drive in the left sidebar.</li>
<li>Click the <code>+</code> button in the top bar to add a new volume (or "Edit" &gt; "Add APFS Volume" in the menu).</li>
<li>Name the volume <code>macOS Sequoia</code> or whatever you like.</li>
<li>Choose a format (commonly "APFS").</li>
<li>Click <code>Add</code> to create the volume.</li>
<li>Click "Done" and close <code>Disk Utility</code> after the volume creation is done.</li>
</ol>
<h4 id="heading-get-the-macos-sequoia-beta">Get the macOS Sequoia beta</h4>
<p>You'll need to download <code>*.pkg</code> files to install on a separate volume. Several sites provide links to installer <code>*.pkg</code> files for macOS betas. Check:</p>
<ul>
<li><a target="_blank" href="https://betaprofiles.dev/install/macos-15/">betaprofiles.dev</a></li>
<li><a target="_blank" href="https://mrmacintosh.com/macos-sequoia-full-installer-database-download-directly-from-apple/">mrmacintosh.com</a></li>
</ul>
<p>Download the latest <code>InstallAssistant.pkg</code>. These files are huge (14GB or more) so a download may take more than 30 minutes with a fast Internet connection.</p>
<h4 id="heading-install-the-macos-sequoia-beta">Install the macOS Sequoia beta</h4>
<p>Double click the <code>InstallAssistant.pkg</code> file to start the installation. Click "Change Install Location" to select the volume you created. In the step "Destination Select" you can select the new volume as the installation destination.</p>
<h3 id="heading-use-the-startup-manager">Use the Startup Manager</h3>
<p>Hold down the power button when starting your Mac to enter the Startup Manager. "Loading startup options" will appear. You have a choice of booting from the internal drive, an external drive (if connected), a disk volume, or "Options."</p>
<p>Select the external drive or volume to boot from. You can set a default for the external drive or volume in <code>System Settings</code> &gt; <code>Startup Disk</code>.</p>
<h2 id="heading-halt-macos-beta-updates">Halt macOS Beta Updates</h2>
<p>If you don't want to continue using macOS Sequoia beta, you can turn off beta updates.</p>
<p>Go to <code>System Settings</code> &gt; <code>General</code> &gt; <code>Software Update</code>. Click the "circle I" info button in <code>Beta Updates</code> and set the <code>Beta Updates</code> to <code>Off</code>. This will stop the macOS beta updates.</p>
<p>This is a necessary step if you don't want to use the macOS beta. If you don't do this, your Mac will continue to update to the latest beta version.</p>
<h2 id="heading-return-to-macos-sonoma">Return to macOS Sonoma</h2>
<p>If you're using an external drive or separate volume to run the macOS beta, you still have macOS Sonoma on your Mac as the primary volume on the internal drive. Reformat the external drive or delete the volume if you no longer want to use the macOS beta.</p>
<h2 id="heading-restore-macos-sonoma-on-a-spare-mac">Restore macOS Sonoma on a Spare Mac</h2>
<p>If you are using macOS Sequoia on a spare Mac, you can restore macOS Sonoma by reinstalling it.</p>
<p>You can download and install macOS Sonoma from the Mac App Store. Search in the Mac App Store for "macOS Sonoma" or use this link to view the listing for <a target="_blank" href="https://apps.apple.com/us/app/macos-sonoma/id6450717509">macOS Sonoma</a>. Click "Get" and the App Store will open <code>System Settings</code> &gt; <code>General</code> &gt; <code>Software Update</code> and begin downloading macOS Sonoma. </p>
<p>Downloads from the App Store are slow, so expect a wait of an hour or more. The App Store installs an application <code>Install macOS Sonoma</code> in the <code>Applications</code> folder.</p>
<p>After the download is complete, the <code>Install macOS Sonoma</code> application will launch automatically. Follow the instructions to install macOS Sonoma.</p>
<p>Alternatively, you can directly download an installer <code>*.pkg</code> file to restore macOS Sonoma. The download is faster than the App Store. Check:</p>
<ul>
<li><a target="_blank" href="https://mrmacintosh.com/macos-sonoma-full-installer-database-download-directly-from-apple/">mrmacintosh.com</a></li>
</ul>
<p>Double click the <code>InstallAssistant.pkg</code> file to start the installation.</p>
<h2 id="heading-whats-next">What's Next</h2>
<p>After you've installed macOS Sequoia, I've got recommendations for a <a target="_blank" href="https://mac.install.guide/mac-setup/">Mac setup</a>, including <a target="_blank" href="https://mac.install.guide/mac-setup/name">Mac name settings</a>, <a target="_blank" href="https://mac.install.guide/mac-setup/dock">Dock settings</a>, and <a target="_blank" href="https://mac.install.guide/mac-setup/finder">Finder settings</a>.</p>
<p>For developing software on the Mac, you'll need to:</p>
<ul>
<li><a target="_blank" href="https://mac.install.guide/commandlinetools/3">Install Xcode Command Line Tools</a> for missing command line tools</li>
<li><a target="_blank" href="https://mac.install.guide/homebrew/3">Install Homebrew</a> as a software package manager</li>
<li><a target="_blank" href="https://mac.install.guide/git/">Install Git</a> for version control</li>
</ul>
<p>When you update macOS, you may also want to install newer software as well. Here are new and recommended applications for macOS Sequoia:</p>
<ul>
<li><a target="_blank" href="https://mac.install.guide/download/terminal">Terminal</a> alternatives</li>
<li><a target="_blank" href="https://mac.install.guide/download/text-editor">Text Editor</a> options</li>
<li><a target="_blank" href="https://mac.install.guide/download/chatgpt">ChatGPT desktop application</a> for better ChatGPT usability</li>
</ul>
<h2 id="heading-conclusion">Conclusion</h2>
<p>After October 2024, you'll need to update macOS from Sonoma to Sequoia to stay up to date with bug fixes, security, and software compatibility, especially if you are a software developer. </p>
<p>Before then, you can try out the macOS Sequoia beta to see what's new and provide feedback to Apple. See an article <a target="_blank" href="https://mac.install.guide/macos/beta">MacOS Beta</a> for more details.</p>
<p>Though macOS Sequoia doesn't bring spectacular changes, new features like Window Tiling and the Passwords app are useful. </p>
<p>Installing the macOS beta takes an hour or more, but you may find it is stable enough for daily use, giving you access to new features now.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ New Features in React 19 – Updates with Code Examples ]]>
                </title>
                <description>
                    <![CDATA[ By Neha sharma ReactJS is one of the most popular UI libraries in the front-end development world. And one of the reasons I love React is because of the team behind it and the community's enthusiasm for it. And when the community speaks up about the ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/new-react-19-features/</link>
                <guid isPermaLink="false">66d46042b6b7f664236cbe12</guid>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ update  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 27 Mar 2024 16:43:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2024/03/Group-27.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Neha sharma</p>
<p>ReactJS is one of the most popular UI libraries in the front-end development world. And one of the reasons I love React is because of the team behind it and the community's enthusiasm for it.</p>
<p>And when the community speaks up about the need for new features and improvements, the team listens.</p>
<p>The future of React is exciting and interesting. If I had to summarise it in one line, I'd say this pretty much sums it up: <em>'Write Less, Do More.'</em></p>
<p>In this article, I will share what's new in React 19 so you can start experimenting with some of the features and learn about what's changing.</p>
<p>Just keep in mind that as I write this, React 19 is still work in progress. Make sure you follow the official guide on GitHub and the official team on social media to stay updated with the latest developments.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/03/image-70.png" alt="Andrew clark tweet on upcoming ReactJS19 new features" width="600" height="400" loading="lazy"></p>
<h3 id="heading-heres-what-well-cover">Here's what we'll cover:</h3>
<ol>
<li><a class="post-section-overview" href="#heading-new-features-in-react-v19-overview">New Features in React v19 – Overview</a></li>
<li><a class="post-section-overview" href="#heading-1-react-compiler">React Compiler</a></li>
<li><a class="post-section-overview" href="#heading-2-server-components">Server Components</a></li>
<li><a class="post-section-overview" href="#heading-3-actions">Actions</a></li>
<li><a class="post-section-overview" href="#heading-4-web-components">Web Components</a></li>
<li><a class="post-section-overview" href="#heading-5-document-metadata">Document Metadata</a></li>
<li><a class="post-section-overview" href="#heading-6-asset-loading">Asset Loading</a></li>
<li><a class="post-section-overview" href="#heading-7-new-react-hooks">New React Hooks</a><br>– <a class="post-section-overview" href="#heading-the-new-use-hook">The new <code>use()</code> hook</a><br>– <a class="post-section-overview" href="#heading-the-useformstatus-hook">The <code>useFormStatus()</code> hook</a><br>– <a class="post-section-overview" href="#heading-the-useformstate-hook">The <code>useFormState()</code> hook</a><br>– <a class="post-section-overview" href="#heading-the-useoptimistic-hook">The <code>useOptimistic()</code> hook</a></li>
<li><a class="post-section-overview" href="#heading-can-i-use-react-19-now">Can I use React 19 Now?</a></li>
<li><a class="post-section-overview" href="#heading-summary">Summary</a></li>
</ol>
<h3 id="heading-pre-requisites">🧩 Pre-requisites:</h3>
<ol>
<li>Working knowledge of ReactJS</li>
<li>Working knowledge of HTML, and JavaScript</li>
<li>Basic hands-on experience in developing web apps in ReactJS</li>
</ol>
<p>If you'd like, you can also watch the <a target="_blank" href="https://www.youtube.com/watch?v=kiDyHRgfwWU">video version</a> of this article.</p>
<h2 id="heading-new-features-in-react-v19-overview">🌟 New Features in React v19 – Overview</h2>
<p>Here's a quick overview of the new features React 19 will have:</p>
<ul>
<li>🤖 <strong>React compiler</strong>: React is working on implementing a new compiler. Currently, Instagram is already leveraging this technology, and it will be released in future versions of React.</li>
<li>🔥 <strong>Server components</strong>: React has introduced the concept of server components after years of development. You'll now be able to use this feature with Next.js.</li>
<li>💪 <strong>Actions</strong>: Actions will also revolutionise how we interact with DOM elements.</li>
<li>🌇 <strong>Document Metadata</strong>: Another much-needed improvement is on the horizon, empowering developers to accomplish more with less code.</li>
<li>💼 <strong>Assets Loading</strong>: This will enable assets to load in the background, which will improve both the application's load time and the user experience.</li>
<li>⚙️ <strong>Web components</strong>: This is particularly fascinating: React code will now enable us to incorporate web components. I'm incredibly excited about this development, as it will unlock a myriad of possibilities.</li>
<li>🪝 <strong>Enhanced hooks</strong>: Exciting new hooks are on the horizon, poised to revolutionise our coding experience.</li>
</ul>
<p>React 19 is set to tackle one of React's longstanding challenges: the issue of excessive re-rendering. Developers have historically spent countless hours addressing this problem, which often leads to performance issues.</p>
<p>The constant hunt for code causing re-rendering and the subsequent optimisation efforts have been a recurring task for engineers. But with React 19, this concern will be alleviated. The framework will handle re-rendering automatically, streamlining the development process.</p>
<p>Previously, developers relied on techniques such as <code>useMemo()</code>, <code>useCallback()</code>, <code>memo</code>, and so on to manage re-rendering. But with React 19, such manual interventions will no longer be necessary. </p>
<p>The framework will intelligently identify and memoize code under the hood, resulting in cleaner and more efficient code.</p>
<p>💻 You can find the code for all the examples <a target="_blank" href="https://github.com/Neha/react-19-examples">on my GitHub here</a>.</p>
<h2 id="heading-1-react-compiler">1. 🤖 🤖 React Compiler 🤖 🤖</h2>
<p>Currently, React doesn't automatically re-render on state change. A way to optimise these re-renders is to manually use <code>useMemo()</code>, <code>useCallback()</code>, and <code>memo</code> APIs. As per React's team, this was a "reasonable manual compromise". Their vision was to let React manage these re-renders. </p>
<p>But the React team realized that manual optimisation is cumbersome, and the feedback from the community encouraged them to solve this issue. </p>
<p>And so the React Team has created the "React compiler". The React compiler will now manage these re-renders. React will decide automatically how and when to change the state and update the UI. </p>
<p>With this, we developers don't need to do this manually anymore. It also means no need to use <code>useMemo()</code>, <code>useCallback()</code>, and <code>memo</code>.</p>
<p>While this will be released in an upcoming version of React, you can learn more about the compiler from these resources:</p>
<ul>
<li>👉 <a target="_blank" href="https://youtu.be/kjOacmVsLSE?si=dqCjg0_9x2hOB8BF">React Compiler video</a></li>
<li>👉 <a target="_blank" href="https://changelog.com/jsparty/311">React Compiler podcast episode</a></li>
</ul>
<p>As a result, React will decide which components to optimise and when, along with what to re-render.</p>
<p>One thing I love about React is that before introducing new breaking changes to the outer world, the React teams use these new features first on their production products 😍. Currently, React Compiler is powering <a target="_blank" href="https://www.instagram.com">Instagram</a> in production.</p>
<h2 id="heading-2-server-components">2. 🔥🔥 Server components 🔥🔥</h2>
<p>If you haven't heard about server components yet, you're missing out on one of the most exciting developments in React and Next.js.</p>
<p>Up until now, React components have primarily run on the client side. But React is introducing the groundbreaking concept of running components on the server side.</p>
<p>The idea of server components has been circulating for years, with Next.js being the pioneer in implementing them for production. Starting from Next.js 13, all components are server components by default. To make a component run on the client side, you need to use the "use client" directive.</p>
<p>In React 19, server components will be integrated directly into React, bringing a host of advantages:</p>
<ul>
<li><strong>SEO</strong>: Server-rendered components enhance search engine optimisation by providing more accessible content to web crawlers.</li>
<li><strong>Performance Boost</strong>: Server components contribute to faster initial page loads and improved overall performance, particularly for content-heavy applications.</li>
<li><strong>Server-Side Execution</strong>: Server components enable executing code on the server, making tasks like API calls seamless and efficient.</li>
</ul>
<p>These advantages underscore the transformative potential of server components in modern web development.</p>
<p>All the components in React by default are client side. Only when you use <code>'use server'</code> will the component be a server component.</p>
<p>The below code is in React but will run on the server. You just need to add <code>'use server'</code> as the first line of the component. This will make the component a "server component". It won't run on the client side and will only run on the server side. </p>
<p>So how can you use a server component?</p>
<p>We can import <code>requestUsername</code> in any React component in the same project. After importing the server component in any React component, we can use   "Actions" (we will learn about this soon) to do a specific task.</p>
<pre><code class="lang-javascript"><span class="hljs-string">'use server'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">requestUsername</span>(<span class="hljs-params">formData</span>) </span>{
  <span class="hljs-keyword">const</span> username = formData.get(<span class="hljs-string">'username'</span>);
  <span class="hljs-keyword">if</span> (canRequest(username)) {
    <span class="hljs-comment">// ...</span>
    <span class="hljs-keyword">return</span> <span class="hljs-string">'successful'</span>;
  }
  <span class="hljs-keyword">return</span> <span class="hljs-string">'failed'</span>;
}
</code></pre>
<p>In the Actions section, you'll learn more about how to use server components.</p>
<p>Currently Next.js has sever-side component support. You can read more about server components in Next <a target="_blank" href="https://nextjs.org/docs/app/building-your-application/rendering/server-components">here</a>. With React19, server component support will be available directly in React.</p>
<h2 id="heading-3-actions">3. 💪💪 Actions 💪💪</h2>
<p>In version 19, another exciting addition will be Actions. This is going to be a game-changer for how we work with forms. </p>
<p>Actions will let you integrate actions with the HTML tag </p>. In simpler terms, you'll be able to replace the <code>onSubmit</code> event with Actions. These actions are HTML form attributes.<p></p>
<h3 id="heading-before-actions">Before Actions:</h3>
<p>In the code snippet below, we'll utilize the <code>onSubmit</code> React event, which triggers the execution of the <code>search</code> method upon form submission. But it's important to note that currently, the <code>search</code> method runs solely on the client-side. We're limited to using React events for form submission, meaning the <code>search</code> cannot be executed on the server side.</p>
<pre><code class="lang-javascript">&lt;form onSubmit={search}&gt;
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"query"</span> /&gt;</span></span>
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>&gt;</span>Search<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>
&lt;/form&gt;
</code></pre>
<h3 id="heading-after-actions">After Actions:</h3>
<p>With the introduction of server components, Actions can be executed on the server side. In our JSX, with </p>, we can drop the <code>onSubmit</code> event and use the <code>action</code> attribute. The value of the action attribute will be a method to submit the data either on the client or server side.<p></p>
<p>You can execute both synchronous and asynchronous operations with actions, streamlining data submission management and state updates. The goal is to make the working with forms and handling data easier. </p>
<p>Let's look at an example to see how this works:</p>
<pre><code class="lang-javascript"><span class="hljs-string">"use server"</span>

<span class="hljs-keyword">const</span> submitData = <span class="hljs-keyword">async</span> (userData) =&gt; {
    <span class="hljs-keyword">const</span> newUser = {
        <span class="hljs-attr">username</span>: userData.get(<span class="hljs-string">'username'</span>),
        <span class="hljs-attr">email</span>: userData.get(<span class="hljs-string">'email'</span>)
    }
    <span class="hljs-built_in">console</span>.log(newUser)
}
</code></pre>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> Form = <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">{submitData}</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">label</span>&gt;</span>Name<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">'username'</span>/&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">label</span>&gt;</span>Name<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"email"</span> /&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">'submit'</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span></span>
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Form;
</code></pre>
<p>In the above code, <code>submitData</code> is the action in the server component. <code>form</code> is a client side component which is using the <code>submitData</code> as action. <code>submitData</code> will be execute on the server. The communication of the client (<code>form</code>), and server (<code>submitData</code>) components is only possible because of the <code>action</code> attribute. </p>
<p>We can use the form and action to handle data submission on the client side as well as on the server side. You can check out this code on <a target="_blank" href="https://github.com/Neha/react-19-examples/blob/main/src/examples/Action.jsx">GitHub</a> and read more about it <a target="_blank" href="https://react.dev/reference/react-dom/components/form#form">here</a>.</p>
<p>In the Enhanced Hooks section, you will learn three new hooks that will also enhance how you can work with forms. </p>
<h2 id="heading-4-web-components">4. ⚙️⚙️ Web components ⚙️⚙️</h2>
<p>Around 5 years ago, I delved into the world of <a target="_blank" href="https://www.webcomponents.org/">web components</a>. Ever since, I've been captivated by their potential. If you're not familiar with web components, let me break them down for you:</p>
<p>Web components allow you to create custom components using native HTML, CSS, and JavaScript, seamlessly incorporating them into your web applications as if they were standard HTML tags. Pretty amazing, right?</p>
<p>Currently, integrating web components into React isn't straightforward. Typically, you either need to convert the web component to a React component or install extra packages and write additional code to make web components work with React. This can be frustrating. </p>
<p>Luckily, React 19 will help you integrate web components into your React code much more easily. If you come across a really useful web component, such as a carousel, you can seamlessly incorporate it into your React projects without the need to convert it into React code.</p>
<p>This streamlines development and allows you to leverage the vast ecosystem of existing web components in your React applications.</p>
<p>But as of now, there are no further details on how the code will look. Still, I am hopeful that it will involve simply importing a web component into a React codebase, similar to module federation. I'm eagerly awaiting further details on this implementation from the React team.</p>
<h2 id="heading-5-document-metadata">5. 🌇🌇 Document Metadata 🌇🌇</h2>
<p>Elements like "title," "meta tags," and "description" are crucial in optimising SEO and ensuring accessibility. In React, where single-page applications are prevalent, managing these elements across different routes can be a bit of a hassle.</p>
<p>Currently, developers often resort to writing custom code, or using packages like react-helmet to handle route changes and update metadata accordingly. This process can be repetitive and error-prone, especially when dealing with SEO-sensitive elements like meta tags. </p>
<h3 id="heading-before">Before:</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> React, { useEffect } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-keyword">const</span> HeadDocument = <span class="hljs-function">(<span class="hljs-params">{ title }</span>) =&gt;</span> {
  useEffect(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-built_in">document</span>.title = title;

     <span class="hljs-keyword">const</span> metaDescriptionTag = <span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'meta[name="description"]'</span>);
    <span class="hljs-keyword">if</span> (metaDescriptionTag) {
    metaDescriptionTag.setAttribute(<span class="hljs-string">'content'</span>, <span class="hljs-string">'New description'</span>);
    }
  }, [title]);

  <span class="hljs-keyword">return</span> <span class="hljs-literal">null</span>;
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> HeadDocument;
</code></pre>
<p>In the above code, we have a component <code>HeadDocument</code> which is responsible for updating the <code>title</code>  and <code>meta</code> tags based on the <code>props</code>. We are updating these in the <code>useEffect</code> hook. We're also using JavaScript to update the title and meta tags. This component will be updated on route change. This is not a clean way to do this.</p>
<h3 id="heading-after">After:</h3>
<p>With React19, we can use the <code>title</code> and <code>meta</code> tags directly in our React components:</p>
<pre><code class="lang-javascript">Const HomePage = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Freecodecamp<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"description"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"Freecode camp blogs"</span> /&gt;</span>
      // Page content
    <span class="hljs-tag">&lt;/&gt;</span></span>
  );
}
</code></pre>
<p>This was not possible before in React. The only way was to use a package like react-helmet.</p>
<p>👉 You can read more in these resources about <a target="_blank" href="https://react.dev/reference/react-dom/components/link">link</a>, <a target="_blank" href="https://react.dev/reference/react-dom/components/meta">meta</a>, <a target="_blank" href="https://react.dev/reference/react-dom/components/script">script</a>, <a target="_blank" href="https://react.dev/reference/react-dom/components/style">style</a>, and <a target="_blank" href="https://react.dev/reference/react-dom/components/title">title</a>.</p>
<h2 id="heading-6-asset-loading">6. 💼💼 Asset Loading 💼💼</h2>
<p>In React, you'll need to carefully manage the loading experience and performance of your applications, particularly with images and other asset files. </p>
<p>Often, the view renders first in the browser, followed by stylesheets, fonts, and images. This can result in a flicker from non-styled (or flash of unstyled content) to a styled view.</p>
<p>To mitigate this issue, developers often resort to adding custom code to detect when these assets are ready, ensuring that the view is displayed only after everything has loaded.</p>
<p>In React 19, images and other files will load in the background as users explore the current page. This improvement should help improve page load times and reduce waiting periods. </p>
<p>Also, React is introducing lifecycle Suspense for assets loading, including scripts, stylesheets, and fonts. This feature enables React to determine when the content is ready to be displayed, eliminating any "unstyled" flickering.</p>
<p>There are new <a target="_blank" href="https://react.dev/reference/react-dom#resource-preloading-apis">Resource Loading APIs</a> like <code>preload</code> and <code>preinit</code> to provide greater control for when a resource should load and initialise.</p>
<p>By allowing assets to load asynchronously in the background, React 19 minimizes waiting times and ensures that users can interact with the content without interruptions. This optimization not only enhances the performance of React applications but also contributes to a more enjoyable browsing experience for users.</p>
<h2 id="heading-7-new-react-hooks">7. 🪝🪝 New React Hooks 🪝🪝</h2>
<p>React Hooks have been one of the most loved features introduced in the library. You have likely used React's built-in hooks many times, and perhaps you've tried making your own custom hooks, too. Hooks are so popular that they've become a React programming pattern.</p>
<p>In React 19, the way we use <code>useMemo</code>, <code>forwardRef</code>, <code>useEffect</code>, and <code>useContext</code> will change. This is mainly because a new hook, <code>use</code>, will be introduced. </p>
<h3 id="heading-usememo">🥁 <code>useMemo()</code>:</h3>
<p>You won't need to use the <code>useMemo()</code> hook after React19, as React Compiler will memoize by itself. </p>
<h4 id="heading-before-1">Before:</h4>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> React, { useState, useMemo } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">ExampleComponent</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> [inputValue, setInputValue] = useState(<span class="hljs-string">''</span>);

  <span class="hljs-comment">// Memoize the result of checking if the input value is empty</span>
  <span class="hljs-keyword">const</span> isInputEmpty = useMemo(<span class="hljs-function">() =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Checking if input is empty...'</span>);
    <span class="hljs-keyword">return</span> inputValue.trim() === <span class="hljs-string">''</span>;
  }, [inputValue]);

  <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">input</span>
        <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span>
        <span class="hljs-attr">value</span>=<span class="hljs-string">{inputValue}</span>
        <span class="hljs-attr">onChange</span>=<span class="hljs-string">{(e)</span> =&gt;</span> setInputValue(e.target.value)}
        placeholder="Type something..."
      /&gt;
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>{isInputEmpty ? 'Input is empty' : 'Input is not empty'}<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> ExampleComponent;
</code></pre>
<h4 id="heading-after-1">After:</h4>
<p>In the below example, you can see that after React19, we don't need to memo the values – React19 will do it by itself under the hood. The code is much cleaner:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> React, { useState, useMemo } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">ExampleComponent</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> [inputValue, setInputValue] = useState(<span class="hljs-string">''</span>);

  <span class="hljs-keyword">const</span> isInputEmpty = <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Checking if input is empty...'</span>);
    <span class="hljs-keyword">return</span> inputValue.trim() === <span class="hljs-string">''</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">input</span>
        <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span>
        <span class="hljs-attr">value</span>=<span class="hljs-string">{inputValue}</span>
        <span class="hljs-attr">onChange</span>=<span class="hljs-string">{(e)</span> =&gt;</span> setInputValue(e.target.value)}
        placeholder="Type something..."
      /&gt;
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>{isInputEmpty ? 'Input is empty' : 'Input is not empty'}<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> ExampleComponent;
</code></pre>
<h3 id="heading-forwardref">🥁 <code>forwardRef()</code></h3>
<p><code>ref</code> will be now passed as props rather than using the <code>forwardRef()</code> hook. This will simplify the code. So after React19, you won't need to use <code>forwardRef()</code>.</p>
<h4 id="heading-before-2">Before:</h4>
<p>Here's an example of how you'd use <code>forwardRef()</code> before React 19:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> React, { forwardRef } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-keyword">const</span> ExampleButton = forwardRef(<span class="hljs-function">(<span class="hljs-params">props, ref</span>) =&gt;</span> (
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">ref</span>=<span class="hljs-string">{ref}</span>&gt;</span>
    {props.children}
  <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>
));
</code></pre>
<h4 id="heading-after-2">After:</h4>
<p><code>ref</code> can be passed as a prop. No more <code>forwardRef()</code> is required.</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> ExampleButton = <span class="hljs-function">(<span class="hljs-params">{ ref, children }</span>) =&gt;</span> (
  <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">ref</span>=<span class="hljs-string">{ref}</span>&gt;</span>
    {children}
  <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>
);
</code></pre>
<h3 id="heading-the-new-use-hook">🥁 The new <code>use()</code> hook</h3>
<p>React19 will introduce a new hook called <code>use()</code>. This hook will simplify how we use promises, async code, and context. </p>
<p>Here is the syntax of hook:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> value = use(resource);
</code></pre>
<p>The below code is an example of how you can use the <code>use</code> hook to make a <code>fetch</code> request:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { use } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">const</span> fetchUsers = <span class="hljs-keyword">async</span> () =&gt; {
    <span class="hljs-keyword">const</span> res = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">'https://jsonplaceholder.typicode.com/users'</span>);
    <span class="hljs-keyword">return</span> res.json();
  };

  <span class="hljs-keyword">const</span> UsersItems = <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">const</span> users = use(fetchUsers());

    <span class="hljs-keyword">return</span> (
      <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
        {users.map((user) =&gt; (
          <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{user.id}</span> <span class="hljs-attr">className</span>=<span class="hljs-string">'bg-blue-50 shadow-md p-4 my-6 rounded-lg'</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">h2</span> <span class="hljs-attr">className</span>=<span class="hljs-string">'text-xl font-bold'</span>&gt;</span>{user.name}<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>{user.email}<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 class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span></span>
    );
  }; 
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> UsersItems;
</code></pre>
<p>Let's understand the code:</p>
<ol>
<li><code>fetchUsers</code> is responsible for the GET request. </li>
<li>We are using the <code>use</code> hook to execute the <code>fetchUsers</code> instead of using the <code>useEffect</code> or <code>useState</code> hooks.</li>
<li>The return of the <code>useState</code> hook is <code>users</code> which will have the response of the GET request (<code>users</code>).</li>
<li>In the return block, we are using <code>users</code> to map over it and create the list.</li>
</ol>
<p>💻 You can check out this code on <a target="_blank" href="https://github.com/Neha/react-19-examples/blob/main/src/examples/Users.jsx">GitHub</a>.</p>
<p>Another place we can use the new hook is with Context. The Context API is a popular way to manage global states in React without using any state management libraries. With the <code>use</code> hook, the <code>context</code> hook will look like the below code.</p>
<p>Now, instead of <code>useContext()</code>, we will have <code>use(context)</code>.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { createContext, useState, use } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-keyword">const</span> ThemeContext = createContext();

<span class="hljs-keyword">const</span> ThemeProvider = <span class="hljs-function">(<span class="hljs-params">{ children }</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> [theme, setTheme] = useState(<span class="hljs-string">'light'</span>);

  <span class="hljs-keyword">const</span> toggleTheme = <span class="hljs-function">() =&gt;</span> {
    setTheme(<span class="hljs-function">(<span class="hljs-params">prevTheme</span>) =&gt;</span> (prevTheme === <span class="hljs-string">'light'</span> ? <span class="hljs-string">'dark'</span> : <span class="hljs-string">'light'</span>));
  };

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">ThemeContext.Provider</span> <span class="hljs-attr">value</span>=<span class="hljs-string">{{</span> <span class="hljs-attr">theme</span>, <span class="hljs-attr">toggleTheme</span> }}&gt;</span>
      {children}
    <span class="hljs-tag">&lt;/<span class="hljs-name">ThemeContext.Provider</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">const</span> Card = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">// use Hook()</span>
  <span class="hljs-keyword">const</span> { theme, toggleTheme } = use(ThemeContext);

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>
      <span class="hljs-attr">className</span>=<span class="hljs-string">{</span>`<span class="hljs-attr">p-4</span> <span class="hljs-attr">rounded-md</span> ${
        <span class="hljs-attr">theme</span> === <span class="hljs-string">'light'</span> ? '<span class="hljs-attr">bg-white</span>' <span class="hljs-attr">:</span> '<span class="hljs-attr">bg-gray-800</span>'
      }`}
    &gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>
        <span class="hljs-attr">className</span>=<span class="hljs-string">{</span>`<span class="hljs-attr">my-4</span> <span class="hljs-attr">text-xl</span> ${
          <span class="hljs-attr">theme</span> === <span class="hljs-string">'light'</span> ? '<span class="hljs-attr">text-gray-800</span>' <span class="hljs-attr">:</span> '<span class="hljs-attr">text-white</span>'
        }`}
      &gt;</span>
        Theme Card
      <span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">p</span> <span class="hljs-attr">className</span>=<span class="hljs-string">{theme</span> === <span class="hljs-string">'light'</span> ? '<span class="hljs-attr">text-gray-800</span>' <span class="hljs-attr">:</span> '<span class="hljs-attr">text-white</span>'}&gt;</span>
       Hello!! use() hook
      <span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">button</span>
        <span class="hljs-attr">onClick</span>=<span class="hljs-string">{toggleTheme}</span>
        <span class="hljs-attr">className</span>=<span class="hljs-string">'bg-blue-500 hover:bg-blue-600 text-white rounded-md mt-4 p-4'</span>
      &gt;</span>
        {theme === 'light' ? 'Switch to Dark Mode' : 'Switch to Light Mode'}
      <span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">const</span> Theme = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">ThemeProvider</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">Card</span> /&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">ThemeProvider</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Theme
</code></pre>
<p>Let's understand the code:</p>
<ol>
<li><code>ThemeProvider</code> is responsible for the context providing.</li>
<li><code>card</code> is the component where we will consume the context. For this we will be using new hook <code>use</code> to consume the context. The rest is the same as before React19.</li>
</ol>
<p>💻 You can check out the above code examples on <a target="_blank" href="https://github.com/Neha/react-19-examples/blob/main/src/examples/Theme.jsx">GitHub</a>.</p>
<p>In React19, we have new hooks to handle form status and data as well. This will make working with forms smoother and easier. Combining these hooks with <code>action</code>s (<a class="post-section-overview" href="#heading-3-actions">new React19 feature</a>) will make working with forms and handling data easier.</p>
<h3 id="heading-the-useformstatus-hook">🥁 The <code>useFormStatus()</code> hook</h3>
<p>This new hook in React19 will help you have more control over the forms you create. It will give you status information about the last form submission. </p>
<p>Here's the syntax:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> { pending, data, method, action } = useFormStatus();
</code></pre>
<p>or the simple version:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> { status } = useFormStatus()
</code></pre>
<p>Let's see what's going on here:</p>
<ol>
<li><strong>pending</strong>: if the form is in a pending state, then it will be <code>true</code>, otherwise it will be <code>false</code>.</li>
<li><strong>data</strong>: an object implementing the <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/FormData"><code>FormData interface</code></a> that contains the data the parent <code>&lt;form&gt;</code> is submitting.</li>
<li><strong>method</strong>: the HTTP method – <code>GET</code>, or <code>POST</code>. By default it will be <code>GET</code>.</li>
<li><strong>action</strong>: a function reference.</li>
</ol>
<p>This hook will be used to display a pending state and what data is being submitted by the user.</p>
<p>Here's a code example:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { useFormStatus } <span class="hljs-keyword">from</span> <span class="hljs-string">"react-dom"</span>;

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Submit</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> status = useFormStatus();
  <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">disabled</span>=<span class="hljs-string">{status.pending}</span>&gt;</span>{status.pending ? 'Submitting...' : 'Submit'}<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span></span>;
}

<span class="hljs-keyword">const</span> formAction = <span class="hljs-keyword">async</span> () =&gt; {
  <span class="hljs-comment">// Simulate a delay of 2 seconds</span>
  <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">resolve</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(resolve, <span class="hljs-number">3000</span>));
}

<span class="hljs-keyword">const</span> FormStatus = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">{formAction}</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">Submit</span> /&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> FormStatus;
</code></pre>
<p>Let's understand what's happening in the above code:</p>
<ol>
<li><code>Submit</code> is a method – a form's action to submit the form. This method will check the <code>status</code> from <code>useFormStatus</code> which will let us know if the <code>status.pending</code> is true or false.</li>
<li>Based on <code>status.pending</code> we can display the message in the UI.</li>
<li><code>formAction</code> is a faker method to delay the form submission.</li>
</ol>
<p>In the above code, on the form submission, from the <code>useFormStatus</code> hook we will get a <code>pending</code> status. While pending is true, the text "Submitting..." will display on the UI. Once <code>pending</code> is <code>false</code>, the Submitting text will be changed to "Submitted".</p>
<p>This hook is powerful and will be helpful when you want to know the status of a form submission (pending or not) and accordingly display the data. </p>
<p>💻 You can check out this code <a target="_blank" href="https://github.com/Neha/react-19-examples/blob/main/src/examples/FormStatus.jsx">here</a>.</p>
<h3 id="heading-the-useformstate-hook">🥁 The <code>useFormState()</code> hook</h3>
<p>Another new hook in React19 is <code>useFormState</code>. It allows you to update state based on the result of a form submission.</p>
<p>Here's the syntax:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> [state, formAction] = useFormState(fn, initialState, permalink?);
</code></pre>
<ol>
<li><code>fn</code>: the function to be called when the form is submitted or button is pressed.</li>
<li><code>initialState</code>: the value you want the state to be initially. It can be any serializable value. This argument is ignored after the action is first invoked.</li>
<li><code>permalink</code>: this is optional. A URL or page link, if <code>fn</code> is going to be run on server then the page will redirect to <code>permalink</code>.</li>
</ol>
<p>This hook will return:</p>
<ol>
<li><code>state</code>: the initial state will be the value we have passed to <code>initialState</code>.</li>
<li><code>formAction</code>: an action that will be passed to the form action. The return value of this will be available in the state.</li>
</ol>
<p>Here's an example of how it works:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { useFormState} <span class="hljs-keyword">from</span> <span class="hljs-string">'react-dom'</span>;

<span class="hljs-keyword">const</span> FormState = <span class="hljs-function">() =&gt;</span> {
    <span class="hljs-keyword">const</span> submitForm = <span class="hljs-function">(<span class="hljs-params">prevState, queryData</span>) =&gt;</span> {
        <span class="hljs-keyword">const</span> name =  queryData.get(<span class="hljs-string">"username"</span>);
        <span class="hljs-built_in">console</span>.log(prevState); <span class="hljs-comment">// previous form state</span>
        <span class="hljs-keyword">if</span>(name === <span class="hljs-string">'john'</span>){
            <span class="hljs-keyword">return</span> {
                <span class="hljs-attr">success</span>: <span class="hljs-literal">true</span>,
                <span class="hljs-attr">text</span>: <span class="hljs-string">"Welcome"</span>
            }
        }
        <span class="hljs-keyword">else</span>{
            <span class="hljs-keyword">return</span> {
                <span class="hljs-attr">success</span>: <span class="hljs-literal">false</span>,
                <span class="hljs-attr">text</span>: <span class="hljs-string">"Error"</span>
            }
        }
    }
    <span class="hljs-keyword">const</span> [ message, formAction ] = useFormState(submitForm, <span class="hljs-literal">null</span>)
    <span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">{formAction}</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">label</span>&gt;</span>Name<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"username"</span> /&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
        {message &amp;&amp; <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>{message.text}<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>}
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span></span>
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> FormState;
</code></pre>
<p>Let's understand what is happening in the above code:</p>
<ol>
<li><code>submitForm</code> is the method responsible for the form submission. This is the Action (remember Action new React19 feature).</li>
<li>Inside <code>submitForm</code>, we are checking the value of the form. Then, depending on whether it's successful or shows an error, we return the specific value and message. In the above code example, if there is any value other than "John", then it will return an error. </li>
<li>We can also check the <code>prevState</code> of the form. The initial state would be <code>null</code>, and after that it will return the <code>prevState</code> of the form.</li>
</ol>
<p>On running this example, you will see a "welcome" message if the name is John – otherwise it will return "error".</p>
<p>💻 You can check out this code <a target="_blank" href="https://github.com/Neha/react-19-examples/blob/main/src/examples/FormState.jsx">here</a>.</p>
<h3 id="heading-the-useoptimistic-hook">🥁 The <code>useOptimistic()</code> hook</h3>
<p><code>useOptimistic</code> is a React Hook that lets you show a different state while an async action is underway, according to the React docs.</p>
<p>This hook will help enhance the user experience and should result in faster responses. This will be useful for applications that need to interact with the server. </p>
<p>Here's the syntax of the <code>useOptimistic</code> hook:</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> [ optimisticMessage, addOptimisticMessage] = useOptimistic(state, updatefn)
</code></pre>
<p>For example, while a response is on the way, we can show a "state" to give the user an immediate response. Once the actual response is returned from the server, the "optimistic" state will be replaced by it.</p>
<p>The <code>useOptimistic</code> hook will immediately update the UI assuming the request will succeed. The name is "optimistic" because the user will see the optimistic (success) result of performing an action, even though the action actually takes time to complete. </p>
<p>Let's look at how we can implement the <code>useOptimistic</code> hook. The below code shows the optimistic state on click of the button submit  <code>&lt;form input&gt; (Sending...)</code> until the response doesn't come.</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { useOptimistic, useState } <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;

<span class="hljs-keyword">const</span> Optimistic = <span class="hljs-function">() =&gt;</span> {
  <span class="hljs-keyword">const</span> [messages, setMessages] = useState([
    { <span class="hljs-attr">text</span>: <span class="hljs-string">"Hey, I am initial!"</span>, <span class="hljs-attr">sending</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">key</span>: <span class="hljs-number">1</span> },
  ]);
  <span class="hljs-keyword">const</span> [optimisticMessages, addOptimisticMessage] = useOptimistic(
    messages,
    <span class="hljs-function">(<span class="hljs-params">state, newMessage</span>) =&gt;</span> [
      ...state,
      {
        <span class="hljs-attr">text</span>: newMessage,
        <span class="hljs-attr">sending</span>: <span class="hljs-literal">true</span>,
      },
    ]
  );

  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">sendFormData</span>(<span class="hljs-params">formData</span>) </span>{
    <span class="hljs-keyword">const</span> sentMessage = <span class="hljs-keyword">await</span> fakeDelayAction(formData.get(<span class="hljs-string">"message"</span>));
    setMessages(<span class="hljs-function">(<span class="hljs-params">messages</span>) =&gt;</span> [...messages, { <span class="hljs-attr">text</span>: sentMessage }]);
  }

  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fakeDelayAction</span>(<span class="hljs-params">message</span>) </span>{
    <span class="hljs-keyword">await</span> <span class="hljs-keyword">new</span> <span class="hljs-built_in">Promise</span>(<span class="hljs-function">(<span class="hljs-params">res</span>) =&gt;</span> <span class="hljs-built_in">setTimeout</span>(res, <span class="hljs-number">1000</span>));
    <span class="hljs-keyword">return</span> message;
  }

  <span class="hljs-keyword">const</span> submitData = <span class="hljs-keyword">async</span> (userData) =&gt; {
    addOptimisticMessage(userData.get(<span class="hljs-string">"username"</span>));

    <span class="hljs-keyword">await</span> sendFormData(userData);
  };

  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;&gt;</span>
      {optimisticMessages.map((message, index) =&gt; (
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{index}</span>&gt;</span>
          {message.text}
          {!!message.sending &amp;&amp; <span class="hljs-tag">&lt;<span class="hljs-name">small</span>&gt;</span> (Sending...)<span class="hljs-tag">&lt;/<span class="hljs-name">small</span>&gt;</span>}
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
      ))}
      <span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">{submitData}</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>OptimisticState Hook<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">label</span>&gt;</span>Username<span class="hljs-tag">&lt;/<span class="hljs-name">label</span>&gt;</span>
          <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"text"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"username"</span> /&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
    <span class="hljs-tag">&lt;/&gt;</span></span>
  );
};

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Optimistic;
</code></pre>
<ol>
<li><code>fakeDelayAction</code> is a fake method to delay the submit event. This is to show the optimistic state.</li>
<li><code>submitData</code> is the action. This method is responsible for the form submission. This could be async, too.</li>
<li><code>sendFormData</code> is responsible for sending the form to <code>fakeDelayAction</code></li>
<li>Setting the default state. <code>messages</code> will be used in the <code>useOptimistic()</code> as input and will return in <code>optimisticMessages</code>.</li>
</ol>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> [messages, setMessages] = useState([{ <span class="hljs-attr">text</span>: <span class="hljs-string">"Hey, I am initial!"</span>, <span class="hljs-attr">sending</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">key</span>: <span class="hljs-number">1</span> },]);
</code></pre>
<p>Now, let's get into more details:</p>
<p>Inside <code>submitData</code>, we are using <code>addOptimisticMessage</code>. This will add the form data so that it will be available in <code>optimisticMessage</code>. We will use this to show a message in the UI:</p>
<pre><code class="lang-javascript">{optimisticMessages.map(<span class="hljs-function">(<span class="hljs-params">message, index</span>) =&gt;</span> (
        <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">key</span>=<span class="hljs-string">{index}</span>&gt;</span>
          {message.text}
          {!!message.sending &amp;&amp; <span class="hljs-tag">&lt;<span class="hljs-name">small</span>&gt;</span> (Sending...)<span class="hljs-tag">&lt;/<span class="hljs-name">small</span>&gt;</span>}
        <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
      ))}
</code></pre>
<p>💻 You can check out this code <a target="_blank" href="https://github.com/Neha/react-19-examples/blob/main/src/examples/Optimistic.jsx">here</a>.</p>
<p>Here is a summary of the 3 form hooks we learned about:</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2024/03/Screenshot-2024-03-16-at-09.41.26.png" alt="Forms flow in reactJS by using the new hooks - useOptimistic(), useFormState(), useFormStatus()" width="600" height="400" loading="lazy">
<em>Summary of new hooks</em></p>
<h2 id="heading-can-i-use-react-19-now">❓Can I Use React 19 Now?</h2>
<p>As of now, all the features mentioned above are available in the canary release. You can learn more <a target="_blank" href="https://react.dev/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024">here</a>. As suggested by the React team, <strong>do not use these for customer/user facing apps at the moment.</strong> Feel free to play around for your own learning, or for fun only. </p>
<p>If you're wondering when React19 is scheduled to release, you can follow the <a target="_blank" href="https://react.dev/blog/2023/05/03/react-canaries">Canary Releases</a> for updates.</p>
<p>To know more, you can follow the React team in the following places to stay updated:</p>
<ul>
<li><a target="_blank" href="https://react.dev/blog/2024/02/15/react-labs-what-we-have-been-working-on-february-2024">Official Website</a></li>
<li><a target="_blank" href="https://react.dev/community/team">Team</a></li>
<li><a target="_blank" href="https://github.com/facebook/react">GitHub</a></li>
<li><a target="_blank" href="https://react.dev/blog/2023/05/03/react-canaries">Canary Releases</a></li>
</ul>
<h2 id="heading-summary">🌟 Summary</h2>
<p>We've covered a lot in this article. Here's a quick summary of the exciting changes coming to React v19:</p>
<ol>
<li>🤖 There will be a new React compiler that will be introduced in a future version of React.</li>
<li>🙌🏽 We'll now have auto re-rendering, memoization, and optimisation of state and UI. </li>
<li>🔮 There will be some new hooks like <code>use()</code> that will help simplify promises and async code.</li>
<li>⚙️ There will now be server side component support in React.</li>
<li>📝 We'll have better form handling using actions, <code>useFormStatus()</code>,  <code>useStatusForm()</code>, and <code>useOptimistic()</code>.</li>
<li>🖼 React will optimise asset loading to enhance performance by using suspense under the hood.</li>
<li>🔗 We'll have web component integration in React.</li>
</ol>
<p>If you liked this article, found something you'd like to discuss, or just want to stay connected, come and say hi on <a target="_blank" href="https://www.linkedin.com/in/nehha/">Linkedln</a>, <a target="_blank" href="https://twitter.com/hellonehha">Twitter</a>, and <a target="_blank" href="https://www.youtube.com/@hellonehha">YouTube</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Discord Update Failed – How to Fix the Error on a Windows 10 PC ]]>
                </title>
                <description>
                    <![CDATA[ Discord is a popular chat app for gamers and anyone else who wants to create an online community. Despite its popularity, one major problem users report about Discord is the update failed loop. Discord has to update often because the Discord team imp... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/discord-update-failed-how-to-fix-the-error-on-a-windows-10-pc/</link>
                <guid isPermaLink="false">66adf0b3febac312b73075a6</guid>
                
                    <category>
                        <![CDATA[ Chat ]]>
                    </category>
                
                    <category>
                        <![CDATA[ discord ]]>
                    </category>
                
                    <category>
                        <![CDATA[ update  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Windows 10 ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Kolade Chris ]]>
                </dc:creator>
                <pubDate>Thu, 18 Aug 2022 15:31:45 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/08/discord--1-.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>Discord is a popular chat app for gamers and anyone else who wants to create an online community. Despite its popularity, one major problem users report about Discord is the update failed loop.</p>
<p>Discord has to update often because the Discord team implements new features and bug fixes regularly. </p>
<p>In addition, the app itself must load new messages from chat rooms and DMs. Once the update fails, Discord gets stuck in an update failed loop.</p>
<p>In this guide, I will show you 4 ways you can fix the Discord update failed error on a Windows 10 computer.</p>
<h2 id="heading-what-well-cover">What We'll Cover</h2>
<ul>
<li><a class="post-section-overview" href="#heading-solution-1-double-check-your-internet-connection">Double-check your Internet Connection</a></li>
<li><a class="post-section-overview" href="#heading-solution-2-run-discord-as-an-administrator">Run Discord as an Administrator</a></li>
<li><a class="post-section-overview" href="#heading-solution-3-rename-discords-updateexe-file">Rename Discord’s Update.exe File</a></li>
<li><a class="post-section-overview" href="#heading-solution-4-temporarily-disable-your-antivirus-program-and-vpn">Temporarily Disable your Antivirus Program and VPN</a></li>
<li><a class="post-section-overview" href="#heading-solution-5-uninstall-and-reinstall-discord">Uninstall and Reinstall Discord</a></li>
<li><a class="post-section-overview" href="#heading-conclusion">Conclusion</a></li>
</ul>
<h2 id="heading-solution-1-double-check-your-internet-connection">Solution 1: Double-check your Internet Connection</h2>
<p>The first thing I would suggest you do is to check your internet connection.</p>
<p>That’s because Discord needs an internet connection to update, as the update has to be done over the internet. Once there’s no internet connection, the update won’t happen.</p>
<p>Make sure your Windows 10 PC is connected to the internet and the internet connection is strong enough.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss1-4.png" alt="ss1-4" width="600" height="400" loading="lazy">
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss2-4.png" alt="ss2-4" width="600" height="400" loading="lazy"> </p>
<h2 id="heading-solution-2-run-discord-as-an-administrator">Solution 2: Run Discord as an Administrator</h2>
<p>A common solution to this issue is to run the Discord app as an admin. </p>
<p>This could fix the issue because any app you want to install needs admin privileges. Discord is not an exception, so granting it admin privileges can make it dig deeper into the issue and resolve it.</p>
<p>To run Discord as administrator, search for Discord and select Run as Administrator on the right:
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss3-4.png" alt="ss3-4" width="600" height="400" loading="lazy"></p>
<h2 id="heading-solution-3-rename-discords-updateexe-file">Solution 3: Rename Discord’s Update.exe File</h2>
<p>There’s a separate executable for updating Discord. This is the update.exe file in the Discord folder. </p>
<p>Renaming this file can force Discord to download a fresh one and subsequently fix the issue for you.</p>
<p><strong>Follow these steps to rename Discord’s update.exe file</strong>
Press <code>WIN</code> (Windows logo key) + <code>R</code> on your keyboard and type in <code>%localappdata%</code>.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss4-5.png" alt="ss4-5" width="600" height="400" loading="lazy"></p>
<p>Look for the Discord folder and open it.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss5-5.png" alt="ss5-5" width="600" height="400" loading="lazy"></p>
<p>Right-click on the <code>Update.exe</code> file and select rename. Then rename it to something like “Updater.exe”. You must not change the extension.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss6-4.png" alt="ss6-4" width="600" height="400" loading="lazy"> </p>
<p>Open the app again and see if the problem gets fixed.</p>
<h2 id="heading-solution-4-temporarily-disable-your-antivirus-program-and-vpn">Solution 4: Temporarily Disable your Antivirus Program and VPN</h2>
<p>Antivirus programs and VPNs are known for interfering with the normal functioning of computers and internet connections. So if you have one or both of them on your PC, it might be stopping Discord from updating.</p>
<p>To disable your antivirus and VPN, open Task Manager, right-click on <code>WIN</code> (Windows logo key) and select Task Manager.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss7-3.png" alt="ss7-3" width="600" height="400" loading="lazy"></p>
<p>Under processes, right-click on Discord and select “End Task”.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss8-3.png" alt="ss8-3" width="600" height="400" loading="lazy"> </p>
<h2 id="heading-solution-5-uninstall-and-reinstall-discord">Solution 5: Uninstall and Reinstall Discord</h2>
<p>If the solutions already discussed fail to work for you, the last resort is to uninstall Discord and reinstall it.</p>
<p><strong>Step 1</strong>: Head over to Control Panel and select Uninstall a Program.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss9-2.png" alt="ss9-2" width="600" height="400" loading="lazy"> </p>
<p><strong>Step 2</strong>: Look for Discord, right-click on it and select uninstall.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss10-2.png" alt="ss10-2" width="600" height="400" loading="lazy"> </p>
<p><strong>Step 3</strong>: To completely remove Discord, press <code>WIN</code> + <code>R</code> on your keyboard, type <code>%localappdata%</code>, and click OK.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss4-5.png" alt="ss4-5" width="600" height="400" loading="lazy"></p>
<p><strong>Step 4</strong>: Right-click on the Discord folder and select Delete.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss11-2.png" alt="ss11-2" width="600" height="400" loading="lazy"> </p>
<p><strong>Step 4</strong>: <a target="_blank" href="https://discord.com/download">Download Discord</a> again and install it.
<img src="https://www.freecodecamp.org/news/content/images/2022/08/ss12-2.png" alt="ss12-2" width="600" height="400" loading="lazy"></p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>I hope the solutions discussed above help you get Discord to update so you can start using it again.</p>
<p>Thank you for reading.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ React 18 New Features – Concurrent Rendering, Automatic Batching, and More ]]>
                </title>
                <description>
                    <![CDATA[ React 18 was released in March 2022. This release focuses on performance improvements and updating the rendering engine.  React 18 sets the foundation for concurrent rendering APIs that future React features will be built on top of.  In this tutorial... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/react-18-new-features/</link>
                <guid isPermaLink="false">66b99d004ed1a5964b77008f</guid>
                
                    <category>
                        <![CDATA[ features ]]>
                    </category>
                
                    <category>
                        <![CDATA[ React ]]>
                    </category>
                
                    <category>
                        <![CDATA[ update  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Shruti Kapoor ]]>
                </dc:creator>
                <pubDate>Thu, 14 Apr 2022 21:58:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/04/featured.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>React 18 was released in March 2022. This release focuses on performance improvements and updating the rendering engine. </p>
<p>React 18 sets the foundation for concurrent rendering APIs that future React features will be built on top of. </p>
<p>In this tutorial, I will give a quick guide of the features released in React 18, and explain a few major concepts such as concurrent rendering, automatic batching and transitions.</p>
<h3 id="heading-react-18-feature-quick-guide">React 18 Feature Quick Guide</h3>
<table>
<thead>
<tr>
<th>Category</th>
<th>Feature</th>
</tr>
</thead>
<tbody>
<tr>
<td>Concept</td>
<td>Concurrent React</td>
</tr>
<tr>
<td>Features</td>
<td>Automatic Batching,  Transitions, Suspense on the server</td>
</tr>
<tr>
<td>APIs</td>
<td>createRoot, hydrateRoot, renderToPipeableStream, renderToReadableStream</td>
</tr>
<tr>
<td>Hooks</td>
<td>useId, useTransition, useDeferredValue, useSyncExternalStore, useInsertionEffect</td>
</tr>
<tr>
<td>Updates</td>
<td>Strict mode</td>
</tr>
<tr>
<td>Deprecated/discouraged</td>
<td>ReactDOM.render, renderToString</td>
</tr>
</tbody>
</table>

<p>Now let's look at each of these updates in more detail. But first, if you haven't already, let's learn how to update React.</p>
<h2 id="heading-how-to-upgrade-to-react-18">How to upgrade to React 18</h2>
<p>Install React 18 and React DOM from npm or yarn, like this:</p>
<p><code>npm install react react-dom</code></p>
<p>Then, you'll want to use <code>createRoot</code> instead of <code>render</code>.</p>
<p>In your index.js, update <code>ReactDOM.render</code> to <code>ReactDOM.createRoot</code> to create a root, and render your app using root.</p>
<p>Here's what it would look like in React 17:</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">import</span> ReactDOM <span class="hljs-keyword">from</span> <span class="hljs-string">'react-dom'</span>;
<span class="hljs-keyword">import</span> App <span class="hljs-keyword">from</span> <span class="hljs-string">'App'</span>;

<span class="hljs-keyword">const</span> container = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'app'</span>);

ReactDOM.render(<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">App</span> /&gt;</span></span>, container);
</code></pre>
<p>And here's what it looks like in React 18:</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">import</span> ReactDOM <span class="hljs-keyword">from</span> <span class="hljs-string">'react-dom'</span>;
<span class="hljs-keyword">import</span> App <span class="hljs-keyword">from</span> <span class="hljs-string">'App'</span>;

<span class="hljs-keyword">const</span> container = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">'app'</span>);

<span class="hljs-comment">// create a root</span>
<span class="hljs-keyword">const</span> root = ReactDOM.createRoot(container);

<span class="hljs-comment">//render app to root</span>
root.render(<span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">App</span> /&gt;</span></span>);
</code></pre>
<h2 id="heading-concurrency-in-react-18">Concurrency in React 18</h2>
<p>To understand concurrency, let’s consider <a target="_blank" href="https://github.com/reactwg/react-18/discussions/46">this example</a> by Dan Abramov from React 18 Working group discussions.</p>
<p>Let’s say that we need to call two people – Alice and Bob. In a non-concurrent setting, we can only have one call at a time. We would first call Alice, end the call, and then call Bob. </p>
<p>This is fine when calls are short, but if call with Alice has a long waiting period (such as on-hold), this can be a time sink.</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/io6s64j30dt3na6yxzp4.png" alt="Non-concurrent call" width="1808" height="418" loading="lazy">
<em>Image showing that in a typical non-concurrent phone conversation, you have to wait for a call to be over before starting a new call.</em></p>
<p>In a concurrent setting, we could call Alice and, once we were put on hold, we could then call Bob. </p>
<p>This doesn’t mean that we are talking to two people at the same time. It just means that we can have two or more concurrent calls at the same time and decide which call is more important.</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v4zgvausl6go1ur769cd.png" alt="Concurrent call" width="1580" height="590" loading="lazy">
<em>Image showing phone conversation between Alice and Bob can be concurrent, by placing a call on hold and answering a more urgent call with Bob first.</em></p>
<p>Similarly, in React 18 with concurrent rendering, React can interrupt, pause, resume, or abandon a render. This allows React to respond to the user interaction quickly even if it is in the middle of a heavy rendering task. </p>
<p>Before React 18, rendering was a single, uninterrupted, synchronous transaction and once rendering started, it couldn’t be interrupted.</p>
<p>Concurrency is a foundational update to React’s rendering mechanism. Concurrency allows React to interrupt rendering. </p>
<p>React 18 introduces the foundation of concurrent rendering and new features such as suspense, streaming server rendering, and transitions are powered by concurrent rendering.</p>
<h2 id="heading-new-react-18-features">New React 18 Features</h2>
<h3 id="heading-automatic-batching">Automatic Batching</h3>
<p>React 18 features automatic batching. To understand batching, let’s consider the example of grocery shopping from the <a target="_blank" href="https://github.com/reactwg/react-18/discussions/46#discussioncomment-846694">same React Working Group discussion</a>. </p>
<p>Let’s say that you are making pasta for dinner. If you were to optimize your grocery trip, you would create a list of all the ingredients that you need to buy, make a trip to the grocery store, and get all your ingredients in one trip. </p>
<p>This is batching. Without batching, you would start cooking, find out you need an ingredient, go to the grocery store and buy the ingredient, come back and continue cooking, only to find out you need another ingredient, go to the grocery store...and drive yourself crazy.</p>
<p>In React, batching helps to reduce the number of re-renders that happen when a state changes, when you call <code>setState</code>. Previously, React batched state updates in event handlers, for example:</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">const</span> handleClick = <span class="hljs-function">() =&gt;</span> {
setCounter();
setActive();
setValue();
}

<span class="hljs-comment">//re-rendered once at the end.</span>
</code></pre>
<p>However, state updates that happened outside of event handlers were not batched. For example, if you had a promise or were making a network call, the state updates would not be batched. Like this:</p>
<pre><code class="lang-jsx">fetch(<span class="hljs-string">'/network'</span>).then( <span class="hljs-function">() =&gt;</span> {
setCounter(); <span class="hljs-comment">//re-rendered 1 times</span>
setActive();  <span class="hljs-comment">//re-rendered 2 times</span>
setValue();   <span class="hljs-comment">//re-rendered 3 times</span>
});

<span class="hljs-comment">//Total 3 re-renders</span>
</code></pre>
<p>As you can tell, this is not performant. React 18 introduces automatic batching which allows all state updates – even within promises, setTimeouts, and event callbacks – to be batched. This significantly reduces the work that React has to do in the background. React will wait for a micro-task to finish before re-rendering.</p>
<p>Automatic batching is available out of the box in React, but if you want to opt-out you can use <code>flushSync</code>.</p>
<h3 id="heading-transitions">Transitions</h3>
<p>Transitions can be used to mark UI updates that do not need urgent resources for updating. </p>
<p>For example, when typing in a typeahead field, there are two things happening: a blinking cursor that shows visual feedback of your content being typed, and a search functionality in the background that searches for the data that is typed.</p>
<p>Showing a visual feedback to the user is important and therefore urgent. Searching is not so urgent, and so can be marked as non-urgent. </p>
<p>These non-urgent updates are called transitions. By marking non-urgent UI updates as "transitions", React will know which updates to prioritize. This makes it easier to optimize rendering and get rid of stale rendering.</p>
<p>You can mark updates as non-urgent by using <code>startTransition</code>. Here is an example of what a typeahead component would like when marked with transitions:</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">import</span> { startTransition } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;

<span class="hljs-comment">// Urgent: Show what was typed</span>
setInputValue(input);

<span class="hljs-comment">// Mark any non-urgent state updates inside as transitions</span>
startTransition(<span class="hljs-function">() =&gt;</span> {
  <span class="hljs-comment">// Transition: Show the results</span>
  setSearchQuery(input);
});
</code></pre>
<h4 id="heading-how-are-transitions-different-from-debouncing-or-settimeout">How are transitions different from debouncing or setTimeout?</h4>
<ol>
<li>startTransition executes immediately, unlike setTimeout.</li>
<li>setTimeout has a guaranteed delay, whereas startTransition's delay depends on the speed of the device, and other urgent renders.</li>
<li>startTransition updates can be interrupted unlike setTimeout and won't freeze the page.</li>
<li>React can track the pending state for you when marked with startTransition.</li>
</ol>
<h3 id="heading-suspense-on-the-server">Suspense on the server</h3>
<p>React 18 introduces:</p>
<ol>
<li>Code splitting on the server with suspense</li>
<li>Streaming rendering on the server</li>
</ol>
<h4 id="heading-client-rendering-vs-server-rendering">Client rendering vs server rendering</h4>
<p>In a client-rendered app, you load the HTML of your page from the server along with all the JavaScript that is needed to run the page, and make it interactive. </p>
<p>If, however, your JavaScript bundle is huge, or you have a slow connection, this process can take a long time and the user will be waiting for the page to become interactive, or to see meaningful content.</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccfllg117u8ycgnl5mv7.png" alt="Illustration of client rendering flow. Source: React Conf 2021 Streaming Server Rendering with Suspense by Shaundai Person https://www.youtube.com/watch?v=pj5N-Khihgc" width="1944" height="956" loading="lazy">
<em>In a client rendering flow, a user has to wait a long time before the page becomes interactive. <a target="_blank" href="https://www.youtube.com/watch?v=pj5N-Khihgc">Source</a>: React Conf 2021 <strong>Streaming Server Rendering with Suspense</strong> by Shaundai Person</em></p>
<p>For optimizing the user experience and avoiding the user having to sit on a blank screen, we can use server rendering. </p>
<p>Server rendering is a technique where you render the HTML output of your React components on the server and send HTML from the server. This lets the user view some UI while JS bundles are loading and before the app becomes interactive. </p>
<p>For a detailed overview of client vs server rendering, <a target="_blank" href="https://www.youtube.com/watch?v=pj5N-Khihgc">check out Shaundai Person’s React Conf 2021 talk</a>.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/4.jpeg" alt="Image" width="600" height="400" loading="lazy">
<em>In a server rendering flow, we can display meaningful data to the user much faster by sending HTML from the server. <a target="_blank" href="https://www.youtube.com/watch?v=pj5N-Khihgc">Source</a>: React Conf 2021 <strong>Streaming Server Rendering with Suspense</strong> by Shaundai Person</em></p>
<p>Server rendering further enhances the user experience of loading the page and reducing time to interactive.</p>
<p>Now what if most of your app is fast except for one part? Maybe this part loads data slowly, or maybe it needs to download a lot of JS before it gets interactive.</p>
<p>Before React 18, this part was often the bottleneck of the app, and would increase the time it took to render the component. </p>
<p>One slow component can slow down the entire page. This is because server rendering was all or nothing – you couldn’t tell React to defer loading of a slow component and couldn’t tell React to send HTML for other components.</p>
<p>React 18 adds support for Suspense on server. With the help of suspense, you can wrap a slow part of your app within the Suspense component, telling React to delay the loading of the slow component. This can also be used to specify a loading state that can be shown while it's loading.</p>
<p>In React 18, one slow component doesn’t have to slow the render of your entire app. With Suspense, you can tell React to send HTML for other components first along with the HTML for the placeholder, like a loading spinner. Then when the slow component is ready and has fetched its data, the server renderer will pop in its HTML in the same stream.</p>
<p><img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/taxrh7y9ylx0l68u2btx.png" alt="You can add suspense to a slow server rendered component in React 18" width="1930" height="986" loading="lazy">
<em>Image showing that suspense on the server can allow a slow component to show a loading state while others are fully rendered.</em></p>
<p>This way the user can see the skeleton of the page as early as possible and see it gradually reveal more content as more pieces of HTML Arrive. </p>
<p>All of this happens before any JS or React loads on the page, which significantly improves the user experience and user-perceived latency.</p>
<h3 id="heading-strict-mode">Strict mode</h3>
<p>Strict mode in React 18 will simulate mounting, unmounting, and re-mounting the component with a previous state. This sets the ground for reusable state in the future where React can immediately mount a previous screen by remounting trees using the same component state before unmounting. </p>
<p>Strict mode will ensure components are resilient to effects being mounted and unmounted multiple times.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In a summary, React 18 sets the foundation for future releases and focusses on improving the user experience. </p>
<p>Upgrading to React 18 should be straightforward and your existing code should not break after the update. The upgrade process should not take more than an afternoon. </p>
<p>Give it a go and let me know what you think!</p>
<p>Sources:</p>
<ol>
<li><a target="_blank" href="https://github.com/reactjs/rfcs/blob/react-18/text/0000-react-18.md">React RFC</a></li>
<li><a target="_blank" href="https://dev.to/shrutikapoor08/what-s-new-in-react-18-1713">My previous React 18 post</a></li>
<li><a target="_blank" href="https://reactjs.org/blog/2022/03/29/react-v18.html">React V18 blog</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=ytudH8je5ko">React Conf 2021 - React for App developers</a></li>
<li><a target="_blank" href="https://www.youtube.com/watch?v=pj5N-Khihgc">React Conf 2021 - Streaming Server Rendering with Suspense</a></li>
</ol>
<p>If you enjoyed this article, give it a ❤️ so others can find it too.</p>
<ul>
<li>For more frequent tips, <a target="_blank" href="http://twitter.com/shrutikapoor08">stay in touch on Twitter</a></li>
<li><a target="_blank" href="http://tinyletter.com/shrutikapoor">Want articles like this directly in your inbox?</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to Update Node and NPM to the Latest Version ]]>
                </title>
                <description>
                    <![CDATA[ By Dillion Megida Node is a runtime environment that allows developers to execute JavaScript code outside the browser, on the server-side.  NPM, on the other hand, is a package manager for publishing JavaScript packages (also known as Node modules) t... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-update-node-and-npm-to-the-latest-version/</link>
                <guid isPermaLink="false">66d84f214540581f645440ef</guid>
                
                    <category>
                        <![CDATA[ node js ]]>
                    </category>
                
                    <category>
                        <![CDATA[ npm ]]>
                    </category>
                
                    <category>
                        <![CDATA[ update  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 12 Apr 2022 20:28:40 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2022/04/pexels-markus-winkler-4052195.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Dillion Megida</p>
<p>Node is a runtime environment that allows developers to execute JavaScript code outside the browser, on the server-side. </p>
<p>NPM, on the other hand, is a package manager for publishing JavaScript packages (also known as Node modules) to the <a target="_blank" href="https://www.npmjs.com/">npm registry</a>. You can also use it to install packages to your applications.</p>
<p>To install Node, you have to go to the <a target="_blank" href="https://nodejs.org/en/">Nodejs website</a> to download the installer. After downloading, you can run the installer, follow the steps, agree to the terms and conditions, and have the installer on your device.</p>
<p>When you install Node, you also get the <code>npm</code> CLI which you can use to manage packages in your applications.</p>
<p>However, Node and NPM can be updated separately to their latest versions, and in the rest of this article, I'll show you how.</p>
<h2 id="heading-how-to-update-node">How to Update Node</h2>
<h3 id="heading-1-use-npm-to-update-your-node-version">1. Use NPM to Update Your Node Version</h3>
<p>To update Node with NPM, you will install the <a target="_blank" href="https://www.npmjs.com/package/n">n</a> package, which will be used to interactively manage node versions on your device.</p>
<p>Here are the steps:</p>
<h4 id="heading-clear-the-npm-cache">Clear the NPM cache</h4>
<p>When you install dependencies, some modules are cached to improve the speed of installation in subsequent downloads. So first, you want to clear the NPM cache.</p>
<h4 id="heading-install-n">Install n</h4>
<pre><code class="lang-shell">npm install -g n
</code></pre>
<p>You'll need to install this package globally as it manages the Node versions at the root.</p>
<h4 id="heading-install-a-new-version-of-node">Install a new version of Node</h4>
<pre><code class="lang-shell">n lts
n latest
</code></pre>
<p>The two commands above install the long-term support and latest versions of Node.</p>
<h4 id="heading-remove-previously-installed-versions">Remove previously installed versions</h4>
<pre><code class="lang-shell">n prune
</code></pre>
<p>This command removes the cached versions of the previously installed versions and only keeps the latest installed version.</p>
<h3 id="heading-2-use-nvm-to-update-your-node-version">2. Use NVM to Update Your Node Version</h3>
<p>NVM stands for Node Version Manager, and as the name implies, it helps you manage your Node Versions. With NVM, you can install Node versions and specify the version of Node that a project uses.</p>
<p>NVM makes it easy to test projects across various Node versions.</p>
<p>To update a Node Version with NVM, you have to install NVM first.</p>
<p>Here is the <a target="_blank" href="https://github.com/nvm-sh/nvm#installing-and-updating">installation guide</a> for NVM.</p>
<p>When installed, you can install packages with:</p>
<pre><code class="lang-shell">nvm install [version]
</code></pre>
<p>You can install the latest version with:</p>
<pre><code class="lang-shell">nvm install node
</code></pre>
<p>And uninstall other versions with:</p>
<pre><code class="lang-shell">nvm uninstall [version]
</code></pre>
<p>With many versions installed, you may also want to specify the version to use at a particular time. One way to do this is by setting a default alias like this:</p>
<pre><code class="lang-shell">nvm alias default [version]
</code></pre>
<p>This way, Node executions will run with the specified version.</p>
<h3 id="heading-3-download-updated-node-binaries">3. Download Updated Node Binaries</h3>
<p>And you can also get the latest versions from the <a target="_blank" href="https://nodejs.org/en/">Node.js</a> website. On it, you can find the latest and long-term support versions for your device.</p>
<p><img src="https://www.freecodecamp.org/news/content/images/2022/04/image-7.png" alt="Image" width="600" height="400" loading="lazy">
<em>Node.js downloads page</em></p>
<p>Downloading the latest version also gives you the latest version of NPM.</p>
<h2 id="heading-how-to-update-npm">How to Update NPM</h2>
<p>Just as you use NPM to update packages, you can use NPM to update itself. Here's the command to achieve this:</p>
<pre><code class="lang-shell">npm install -g npm@latest
</code></pre>
<p>This command will install the latest version of NPM globally.</p>
<p>On Mac, you may have to pass the <code>sudo</code> command before NPM, as this installs NPM at the root of your device, and you need privileges to do that.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this article, we've seen how to update Node and NPM to their latest versions.</p>
<p>To reiterate, when you install Node, you automatically get NPM. If you also update Node by installing the binaries from the website, you get an updated NPM.</p>
<p>We also saw other ways to update Node and NPM globally on your device.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ What is the Latest Android Version? And How to Update to the Current Android OS? ]]>
                </title>
                <description>
                    <![CDATA[ By Slava Vaniukov Over the last few years, Android OS has come to dominate the mobile OS landscape with over 86% market share as of 2019. The system provides high-performing and secure usage and comes with regular version updates with new features.  ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-update-to-the-current-android-version/</link>
                <guid isPermaLink="false">66d460ee733861e3a22a735b</guid>
                
                    <category>
                        <![CDATA[ Android ]]>
                    </category>
                
                    <category>
                        <![CDATA[ update  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 06 Apr 2020 23:32:51 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/04/how-to-update-your-mobile-to-the-latest-Android-version-2.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Slava Vaniukov</p>
<p>Over the last few years, Android OS has come to dominate the mobile OS landscape with <a target="_blank" href="https://www.idc.com/promo/smartphone-market-share/os">over 86% market share as of 2019</a>. The system provides high-performing and secure usage and comes with regular version updates with new features. </p>
<p>Because of this, many Android users want to know how to check their current Android version and update it to the latest one.</p>
<p>So in this article, we will learn how to figure out which version your smartphone is running and how to install an Android OS update. But before that let’s get a quick overview of the history of Android versions.  </p>
<h2 id="heading-a-brief-history-of-the-android-operating-system"><strong>A Brief History of the Android Operating System</strong></h2>
<p>Google first introduced the revolutionary Android operating system as an alternative to Apple’s iOS in late 2008.</p>
<p>Since it’s existed, Android has had 12 versions since its humble beginning with sometimes even more than one release in a year.</p>
<p>The constant support from Google developers made the system the top OS with almost 3 million apps in the Play Store. This helped switch Android app development from Java to Kotlin and ensured that <a target="_blank" href="https://www.softermii.com/blog/android-developer-salaries-in-2019-top-8-regions">Android developers were highly paid</a> and quite in demand on the market.</p>
<p>Here I've gathered an abridged listing to demonstrate how the operating system has been changing and evolving to provide users with advanced functionality. For much of its lifetime, the OS version was designated by a number and a codename.   </p>
<ul>
<li><strong>Android 1.0 to 1.1</strong> - Google’s original mobile OS offered basic capability with integrated apps like Gmail, Maps, Calendar, and YouTube.</li>
<li><strong>Android 1.5 or Cupcake</strong> - Released in early 2009, this was the first-named version of the OS. It included an on-screen keyboard and introduced the framework for third-party apps to be run on mobile devices.</li>
<li><strong>Android 2.0-2.1 or Eclair</strong> - Version 2.0 added real-time traffic information, voice-guided navigation, and pinch-to-zoom capability to the OS.</li>
<li><strong>Android 2.3 or Gingerbread</strong> - The 2010 release of this OS focused on the black and green interface as Android began to develop a distinctive look.</li>
<li><strong>Android 3.0-3.2 or Honeycomb</strong> - Released in 2011, this version of the operating system was specifically for tablet devices and introduced on-screen buttons. </li>
<li><strong>Android 4.0 or Ice Cream Sandwich</strong> - This was a unified OS for phones and tablets all released in 2011 which featured a holographic appearance and made extensive use of swiping when using the system.</li>
<li><strong>Android 4.4 or Kit-Kat</strong> - Late 2013 saw this update which lightened the interface’s color scheme and introduced the world to “OK, Google” support.</li>
<li><strong>Android 5.0-5.1 or Lollipop</strong> - Major changes were made with 2014’s upgrade. Google introduced the card-based Material Design standard employed to unify the appearance of items displayed by the OS.</li>
<li><strong>Android 6.0 or Marshmallow</strong> - This relatively minor update in 2015 was the beginning of Google’s patterns of relaying a new, numbered version every year.</li>
<li><strong>Android 7.0-7.1 or Nougat</strong> - 2016’s entry in the Android OS lexicon added native split-screen mode and launched Google Assistant.</li>
<li><strong>Android 9 or Pie</strong> - Google released this last-named version of Android in August of 2018. The most visible updates of this version for users were the large Home and small Back buttons to the user interface and <a target="_blank" href="https://www.freecodecamp.org/news/the-new-security-features-in-android-pie-and-why-im-excited-about-them-4a2f45be61fe/">new security features</a>.</li>
<li><strong>Android 10</strong> - is the last live version of OS and we will cover it in more detail below.</li>
</ul>
<h2 id="heading-main-features-of-android-10"><strong>Main Features of Android 10</strong></h2>
<p>Android 10 was released on September 3, 2019. It has many new and improved features that are good reason to upgrade your Android OS if you are still using version 9. </p>
<p>Here are <a target="_blank" href="https://www.android.com/android-10/">some of the highlights</a> of the current Android version.   </p>
<ul>
<li><strong>Live Caption</strong> gives users the ability to automatically caption media playing on your device.</li>
<li><strong>Smart Reply</strong> helps streamline communication by suggesting responses and recommending actions. </li>
<li><strong>Sound Amplifier</strong> lets you fine-tune the audio settings of your phone to allow you to hear more clearly.</li>
<li><strong>Gesture Navigation</strong> introduces more intuitive ways to swipe and pull and provides added flexibility to the Android interface.</li>
<li><strong>Dark Theme</strong> uses true black to save battery power and give your eyes a rest. Some users may prefer it to Android’s normal look.</li>
<li><strong>Enhanced security settings</strong> let you exert more control over the privacy of your data. You can control how data and location information is shared from the same settings area.</li>
<li><strong>Digital Well-being</strong> is a tool that strives to help users find the right balance between work and the rest of their lives. It has features that can help you be more productive or unplug for some much-needed relaxation.</li>
<li><strong>Focus mode</strong> is designed to help users stay focused on specific tasks by minimizing distractions. It lets you temporarily pause apps that may distract you by simply tapping on them.</li>
<li><strong>Family Link</strong> enables digital ground rules to be set and can help parents guide their children’s online activities. Set limits on screen time, restrict content and manage apps for your family.</li>
</ul>
<p>If you have recently purchased a new Android comparable device, it probably came with Android 10 installed. If that is not the case, these features might persuade you that you need to update the Android OS on your phone or tablet. </p>
<h2 id="heading-checking-your-current-android-os-and-updating-to-version-10"><strong>Checking Your Current Android OS and updating to Version 10</strong></h2>
<p>When you are preparing to upgrade your mobile device, you need to know what is the latest Android OS version that can run on your machine. Some older devices may be restricted as to the version that they can handle. </p>
<p>Depending on the type of device and its age, the method of obtaining an Android OS download may vary. Newer devices will receive updates more quickly and users of Google devices will get notifications when they are available. </p>
<p>Here’s how to update your Android OS. Some preliminary steps should be taken before performing the actual update.</p>
<h3 id="heading-check-your-android-version">Check Your Android Version</h3>
<p>The exact steps needed to perform a version check will be determined by your type of device. You want to get to the <strong>About phone</strong> information which is found in the device’s <strong>Settings</strong>. The model number can also be found here and should be noted before you begin your update.</p>
<ol>
<li>Go to the <strong>Settings</strong> and scroll down to find out the <strong>System</strong> category.</li>
</ol>
<p><img src="https://lh5.googleusercontent.com/k1wo6Fwn6tLEGrOWGtd4dzu5IR-I-ZNMwyxv12Y5gV0S89vVQuYe6nrfGtCeVFHJLyefukEIyCSby2tfgIziSjsaJPTJF6s0QwERHN1R44HoEgOidwGp-fGCF562hMH-UBfmyUJu" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="2">
<li>In the <strong>System Settings</strong> section click on <strong>About device</strong></li>
</ol>
<p><img src="https://lh5.googleusercontent.com/6jigAGGh9ecBZ29YRAh0zqwpMIW4LAUV6ebGyrQCBu87LPbwNzQVgxzwmdkG4WqPXJji5gqxmH1BADNvp7xV6ZsmKjLwHw9TQVDJ6rzNUrJMghrhbjMqNa3_CM5V6-ctCGrrBjse" alt="Image" width="600" height="400" loading="lazy"></p>
<ol start="3">
<li>Here scroll down to the end of list until you see <strong>Android version</strong> which means the version your mobile is running now.</li>
</ol>
<p><img src="https://lh5.googleusercontent.com/IGcvELlHO8csue10jvloG9OqxachPjKV449F5Q_ILuHIAViFNVKbo9jAJf3e5dPoVc9n3Am1VEMhIIot29FvLhxAi-5Tk6WVOSEhfTigh72-kTRtHqjQEXj5D51CKliqO86z_n4x" alt="Image" width="600" height="400" loading="lazy"></p>
<p>If you decide to update your OS manually, here are a few tips to keep in mind before that:</p>
<p><strong>Back up your data</strong> - You should be backing up your data regularly. Before an operating system upgrade is always a good time for a backup. You never know what might happen, so don’t take chances with your important data. Many backup apps are available. Get one and use it.</p>
<p><strong>Verify your available space</strong> - The upgrade will detail how much space is necessary for your upgrade. Make sure you have enough space or move some things off of the device to free up enough for the update.</p>
<p><strong>Updating the OS</strong> - If you have received an over-the-air (OTA) notification, you can simply open it up and tap the update button. You can also go to <strong>Check for Updates</strong> in <strong>Settings</strong> to initiate the upgrade.</p>
<p><strong>Note:</strong> Some users may prefer to root their device to obtain updates as soon as they are available as well as being able to have more control over the device and what apps run on it.</p>
<h2 id="heading-what-to-expect-in-android-11"><strong>What to Expect in Android 11</strong></h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/04/android11-preview.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Even though there are considerable technical advances in version 10, Google plans to release the newest Android OS according to plan sometime in 2020. As you may have noticed, the company does not like to stand still. </p>
<p>Android 11 will focus on changes to privacy and security, application behavior, and new features including APIs. The operating system will provide support for 5G and foldable devices, positioning it to capitalize on the move to faster networks. Some specific features are:  </p>
<ul>
<li>Biometric authentication capabilities to more securely protect your device;</li>
<li>Restricts repeatable permission requests to make apps more user-friendly;</li>
<li>Allows temporary permission to be given to the camera, microphone, and location services;</li>
<li>Apps can automatically run authentication and connect to an available secure WiFi hotspot;</li>
<li>Expanded camera support;</li>
<li>Chat bubbles can be turned on and off for individual apps.</li>
</ul>
<p>These are just a few of the <a target="_blank" href="https://proandroiddev.com/android-11-developer-preview-all-you-should-stayed-tune-about-88317e21469">new Android 11 features</a> that the users will expect. App designers will also enjoy the extended functionality they can bring to their creations. </p>
<h2 id="heading-wrapping-up">Wrapping Up</h2>
<p>Except in very rare cases, you should upgrade your Android device when new versions are released. Google consistently provided many useful improvements to the functionality and performance of new Android OS versions. If your device can handle it, you just might want to check it out.   </p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
