<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: swagath TP</title>
    <description>The latest articles on Forem by swagath TP (@swagath_tp_).</description>
    <link>https://forem.com/swagath_tp_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2766488%2F117fb3c1-6e80-4b06-bdda-4afca102dc5a.jpg</url>
      <title>Forem: swagath TP</title>
      <link>https://forem.com/swagath_tp_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/swagath_tp_"/>
    <language>en</language>
    <item>
      <title>Simple Tweaks That Can Make Your Meilisearch Faster</title>
      <dc:creator>swagath TP</dc:creator>
      <pubDate>Sun, 03 Aug 2025 16:12:07 +0000</pubDate>
      <link>https://forem.com/swagath_tp_/simple-tweaks-that-can-make-your-meilisearch-faster-iil</link>
      <guid>https://forem.com/swagath_tp_/simple-tweaks-that-can-make-your-meilisearch-faster-iil</guid>
      <description>&lt;p&gt;&lt;a href="https://www.meilisearch.com/" rel="noopener noreferrer"&gt;Meilisearch&lt;/a&gt; is a really powerful search engine; it’s fast, open-source, and easy to set up.&lt;/p&gt;

&lt;p&gt;But if you don’t configure it properly, especially the indexing and attributes, it can start to feel slow.&lt;/p&gt;

&lt;p&gt;Let’s say you set up an index with a few thousand records and start running searches. At first, things feel snappy — queries respond in under &lt;code&gt;20ms&lt;/code&gt;, which is very fast.&lt;/p&gt;

&lt;p&gt;But then you notice that some searches — especially those with 3 or more keywords — are suddenly taking above &lt;code&gt;300ms&lt;/code&gt; or more, even on a local instance.&lt;/p&gt;

&lt;p&gt;Making just a few small tweaks to how you set up your indexes and attributes can significantly improve speed and overall performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Makes Meilisearch Slow?
&lt;/h2&gt;

&lt;p&gt;Have you ever felt like your Meilisearch results are a bit slow? Maybe you’ve had to wait longer than expected for a simple search to load.&lt;/p&gt;

&lt;p&gt;In many cases, just tweaking how you index your data can make a huge difference. Small changes, like setting up your searchable and filterable attributes properly or avoiding unnecessary fields, can significantly speed things up.&lt;/p&gt;

&lt;p&gt;These little optimizations not only improve performance but also make the whole search experience smoother.&lt;/p&gt;

&lt;h2&gt;
  
  
  Optimizing Searchable Attributes
&lt;/h2&gt;

&lt;p&gt;When we are working with Meilisearch, it's important to understand which fields in your documents actually need to be searchable.&lt;/p&gt;

&lt;p&gt;Sometimes, fields like numeric values or booleans—such as price, age, or isActive—are only used for filtering or sorting and don’t need to be part of the &lt;a href="https://www.meilisearch.com/docs/reference/api/settings#searchable-attributes" rel="noopener noreferrer"&gt;searchable attributes&lt;/a&gt;. Including these fields in your searchableAttributes list can slow down indexing and impact search performance unnecessarily.&lt;/p&gt;

&lt;p&gt;By removing any non-essential fields from the searchable list, Meilisearch focuses on what really matters for search, leading to faster and more efficient results.&lt;/p&gt;

&lt;p&gt;When I didn’t set any searchable attributes, the search took &lt;code&gt;31ms&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"swagath@VictusbyHP":"~$ time curl -X POST""http://127.0.0.1:7700/indexes/shows/search""-H""Content-Type: application/json""-H""Authorization: Bearer mPGrxPdYtrbGtfQPUMtJfHTyzkkTOtVs6cWXcT4r3-E""--data-raw""{ \"q\": \"Gilbert Chan\" }"{
   "hits":[
      {
         "Show_Id":"s3",
         "Category":"Movie",
         "Title":"23:59",
         "Director":"Gilbert Chan",
         "Cast":"Tedd Chan, Stella Chung, Henley Hii, Lawrence Koh, Tommy Kuan, Josh Lai, Mark Lee, Susan Leong, Benjamin Lim",
         "Country":"Singapore",
         "Release_Date":"December 20, 2018",
         "Rating":"R",
         "Duration":"78 min",
         "Type":"Horror Movies, International Movies",
         "Description":"When an army recruit is found dead, his fellow soldiers are forced to confront a terrifying secret that's haunting their jungle island training camp."
      },
      {
         "Show_Id":"s7015",
         "Category":"Movie",
         "Title":"The Workshop",
         "Director":"Laurent Cantet",
         "Cast":"Marina Foïs, Matthieu Lucci, Warda Rammach, Issam Talbi, Florian Beaujean, Mamadou Doumbia, Julien Souve, Mélissa Guilbert, Olivier Thouret, Lény Sellam",
         "Country":"France",
         "Release_Date":"November 10, 2018",
         "Rating":"TV-MA",
         "Duration":"114 min",
         "Type":"Dramas, International Movies",
         "Description":"In an old shipyard town in France, sociopolitical tensions beset a writing workshop where the instructor notices a student with a dark side."
      }
   ],
   "query":"Gilbert Chan",
   "processingTimeMs":20,
   "limit":20,
   "offset":0,
   "estimatedTotalHits":14
}real    0m0.031s
user    0m0.004s
sys     0m0.004s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After specifying &lt;code&gt;Director&lt;/code&gt; as a searchable attribute, the search time dropped to 10ms&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"swagath@VictusbyHP":"~$ time curl -X POST""http://127.0.0.1:7700/indexes/shows/search""-H""Content-Type: application/json""-H""Authorization: Bearer mPGrxPdYtrbGtfQPUMtJfHTyzkkTOtVs6cWXcT4r3-E""--data-raw""{ \"q\": \"Gilbert Chan\" }"{
   "hits":[
      {
         "Show_Id":"s3",
         "Category":"Movie",
         "Title":"23:59",
         "Director":"Gilbert Chan",
         "Cast":"Tedd Chan, Stella Chung, Henley Hii, Lawrence Koh, Tommy Kuan, Josh Lai, Mark Lee, Susan Leong, Benjamin Lim",
         "Country":"Singapore",
         "Release_Date":"December 20, 2018",
         "Rating":"R",
         "Duration":"78 min",
         "Type":"Horror Movies, International Movies",
         "Description":"When an army recruit is found dead, his fellow soldiers are forced to confront a terrifying secret that's haunting their jungle island training camp."
      }
   ],
   "query":"Gilbert Chan",
   "processingTimeMs":0,
   "limit":20,
   "offset":0,
   "estimatedTotalHits":1
}real    0m0.010s
user    0m0.002s
sys     0m0.005s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I initially didn’t set any searchableAttributes, so Meilisearch ended up searching through every field in the document. This made the search slower, around &lt;code&gt;31ms&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Later, I explicitly set only the Director field as searchable, and the search time dropped to &lt;code&gt;10ms&lt;/code&gt;. By telling Meilisearch exactly where to look, I avoided unnecessary processing and made the search way faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing the Right Filterable Attributes
&lt;/h2&gt;

&lt;p&gt;Just like searchable attributes, it's a good idea to be careful with what you add to your &lt;a href="https://www.meilisearch.com/docs/learn/filtering_and_sorting/filter_search_results" rel="noopener noreferrer"&gt;filterable attributes&lt;/a&gt; in Meilisearch. &lt;/p&gt;

&lt;p&gt;It might seem okay to make everything filterable, but that can slow things down and make your index heavier. We only have to add fields that we really plan to use for filtering, like category, status, or isActive. These are the kinds of fields users might select in a filter or dropdown.&lt;/p&gt;

&lt;p&gt;I had many fields marked as filterable — everything from Title to Country to Description. When I ran a filtered search using just Show_Id, it took &lt;code&gt;19ms&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"swagath@VictusbyHP":"~$ curl -X GET""http://127.0.0.1:7700/indexes/shows/settings/filterable-attributes""\\
  -H""Authorization: Bearer mPGrxPdYtrbGtfQPUMtJfHTyzkkTOtVs6cWXcT4r3-E"[
   "Show_Id",
   "Category",
   "Title",
   "Director",
   "Cast",
   "Country",
   "Release_Date",
   "Rating",
   "Duration",
   "Type",
   "Description"
]
swagath@VictusbyHP":"~$ time curl -X POST""http://127.0.0.1:7700/indexes/shows/search""-H""Content-Type: application/json""-H""Authorization: Bearer mPGrxPdYtrbGtfQPUMtJfHTyzkkTOtVs6cWXcT4r3-E""--data-raw""{
    \"q\": \"Gilbert Chan\",
    \"filter\": \"Show_Id = \"s3\"\"
  }"{
   "hits":[
      {
         "Show_Id":"s3",
         "Category":"Movie",
         "Title":"23:59",
         "Director":"Gilbert Chan",
         "Cast":"Tedd Chan, Stella Chung, Henley Hii, Lawrence Koh, Tommy Kuan, Josh Lai, Mark Lee, Susan Leong, Benjamin Lim",
         "Country":"Singapore",
         "Release_Date":"December 20, 2018",
         "Rating":"R",
         "Duration":"78 min",
         "Type":"Horror Movies, International Movies",
         "Description":"When an army recruit is found dead, his fellow soldiers are forced to confront a terrifying secret that's haunting their jungle island training camp."
      }
   ],
   "query":"Gilbert Chan",
   "processingTimeMs":0,
   "limit":20,
   "offset":0,
   "estimatedTotalHits":1
}real    0m0.019s
user    0m0.000s
sys     0m0.007s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I only ever needed to filter by Show_Id, so I cleaned up the filterableAttributes and kept only that one field. The search got even faster, down to &lt;code&gt;10ms&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"swagath@VictusbyHP":"~$ time curl -X POST""http://127.0.0.1:7700/indexes/shows/search""-H""Content-Type: application/json""-H""Authorization: Bearer mPGrxPdYtrbGtfQPUMtJfHTyzkkTOtVs6cWXcT4r3-E""--data-raw""{
    \"q\": \"Gilbert Chan\",
    \"filter\": \"Show_Id = \"s3\"\"
  }"{
   "hits":[
      {
         "Show_Id":"s3",
         "Category":"Movie",
         "Title":"23:59",
         "Director":"Gilbert Chan",
         "Cast":"Tedd Chan, Stella Chung, Henley Hii, Lawrence Koh, Tommy Kuan, Josh Lai, Mark Lee, Susan Leong, Benjamin Lim",
         "Country":"Singapore",
         "Release_Date":"December 20, 2018",
         "Rating":"R",
         "Duration":"78 min",
         "Type":"Horror Movies, International Movies",
         "Description":"When an army recruit is found dead, his fellow soldiers are forced to confront a terrifying secret that's haunting their jungle island training camp."
      }
   ],
   "query":"Gilbert Chan",
   "processingTimeMs":0,
   "limit":20,
   "offset":0,
   "estimatedTotalHits":1
}real    0m0.010s
user    0m0.000s
sys     0m0.008s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a field isn’t going to be used in filters, it’s better to leave it out. Keeping the filterable list clean helps Meilisearch work faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep Meilisearch for Searching Only
&lt;/h2&gt;

&lt;p&gt;Meilisearch is built for fast and efficient information retrieval, not for storing your entire dataset like a database. It works best when you index only the documents that you actually need to search.&lt;/p&gt;

&lt;p&gt;The more documents you add, the heavier it becomes—indexing takes longer, and search performance can slow down. So, it’s a good idea to keep your index focused. &lt;/p&gt;

&lt;h3&gt;
  
  
  Flatten Your Data for Better Speed
&lt;/h3&gt;

&lt;p&gt;Are you storing full HTML content or deeply nested objects inside your documents?&lt;/p&gt;

&lt;p&gt;If so, that might be slowing your Meilisearch down. These types of fields add unnecessary weight to each document, making indexing heavier and searches less efficient.&lt;/p&gt;

&lt;p&gt;Optimizing your Meilisearch index structure can make a big difference in performance. Instead of dumping everything in, try to normalize and flatten your data before indexing.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68u033vareutxryf4mdq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68u033vareutxryf4mdq.png" alt="Screenshot 2025-08-02 192301" width="800" height="489"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keep only what you need for searching and filtering.&lt;/p&gt;
&lt;h2&gt;
  
  
  Avoid Overload
&lt;/h2&gt;

&lt;p&gt;Fetching too many results at once can slow down your app and put extra load on the server.&lt;br&gt;
In Meilisearch, large search responses mean more work for the CPU and bigger payloads to send over the network.&lt;/p&gt;

&lt;p&gt;A simple way to avoid this is by using pagination. By default, Meilisearch returns 20 results per page, which is usually enough for most use cases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"swagath@VictusbyHP":"~$ time curl -X POST""http://127.0.0.1:7700/indexes/shows/search""-H""Content-Type: application/json""-H""Authorization: Bearer mPGrxPdYtrbGtfQPUMtJfHTyzkkTOtVs6cWXcT4r3-E""--data-raw""{
    \"q\": \"s3\",
    \"limit\": 50
  }"{
   "hits":[
      {
         "Show_Id":"s3",
         "Category":"Movie",
         "Title":"23:59",
         "Director":"Gilbert Chan",
         "Cast":"Tedd Chan, Stella Chung, Henley Hii, Lawrence Koh, Tommy Kuan, Josh Lai, Mark Lee, Susan Leong, Benjamin Lim",
         "Country":"Singapore",
         "Release_Date":"December 20, 2018",
         "Rating":"R",
         "Duration":"78 min",
         "Type":"Horror Movies, International Movies",
         "Description":"When an army recruit is found dead, his fellow soldiers are forced to confront a terrifying secret that's haunting their jungle island training camp."
      },

   ],
   "query":"s3",
   "processingTimeMs":1,
   "limit":50,
   "offset":0,
   "estimatedTotalHits":1000
}real    0m0.017s
user    0m0.004s
sys     0m0.005s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After reducing the limit to 10 it took only &lt;code&gt;10ms&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"swagath@VictusbyHP":"~$ time curl -X POST""http://127.0.0.1:7700/indexes/shows/search""-H""Content-Type: application/json""-H""Authorization: Bearer mPGrxPdYtrbGtfQPUMtJfHTyzkkTOtVs6cWXcT4r3-E""--data-raw""{
    \"q\": \"s3\",
    \"limit\": 10
  }"{
   "hits":[
      {
         "Show_Id":"s3",
         "Category":"Movie",
         "Title":"23:59",
         "Director":"Gilbert Chan",
         "Cast":"Tedd Chan, Stella Chung, Henley Hii, Lawrence Koh, Tommy Kuan, Josh Lai, Mark Lee, Susan Leong, Benjamin Lim",
         "Country":"Singapore",
         "Release_Date":"December 20, 2018",
         "Rating":"R",
         "Duration":"78 min",
         "Type":"Horror Movies, International Movies",
         "Description":"When an army recruit is found dead, his fellow soldiers are forced to confront a terrifying secret that's haunting their jungle island training camp."
      },
      {
         "Show_Id":"s36",
         "Category":"Movie",
         "Title":"#Rucker50",
         "Director":"Robert McCullough Jr.",
         "Cast":"",
         "Country":"United States",
         "Release_Date":"December 1, 2016",
         "Rating":"TV-PG",
         "Duration":"56 min",
         "Type":"Documentaries, Sports Movies",
         "Description":"This documentary celebrates the 50th anniversary of the Harlem sports program that has inspired countless city kids to become pro basketball players."
      },
   ],
   "query":"s3",
   "processingTimeMs":0,
   "limit":10,
   "offset":0,
   "estimatedTotalHits":1000
}real    0m0.010s
user    0m0.003s
sys     0m0.004s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unless you really need more, it’s better not to increase the limit too much. Keeping the number of results small helps your search stay fast.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup your Index First
&lt;/h2&gt;

&lt;p&gt;When you're creating a new index in Meilisearch, it's a good idea to configure the settings before you start adding documents.&lt;/p&gt;

&lt;p&gt;Things like searchableAttributes or filterableAttributes—if you tweak these after the data is already in, Meilisearch will need to reindex everything. And yep, that can take a while if your dataset is big.&lt;/p&gt;

&lt;p&gt;To save time and avoid that extra work, just get your settings right first, then load your documents.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Optimization Area&lt;/th&gt;
&lt;th&gt;wihout optimizing&lt;/th&gt;
&lt;th&gt;with optimizing&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Searchable Attributes&lt;/td&gt;
&lt;td&gt;31ms&lt;/td&gt;
&lt;td&gt;10ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Filterable Attributes&lt;/td&gt;
&lt;td&gt;19ms&lt;/td&gt;
&lt;td&gt;10ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Overloaded Payloads&lt;/td&gt;
&lt;td&gt;17ms (limit: 50)&lt;/td&gt;
&lt;td&gt;10ms (limit: 10)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Data structure (raw HTML / nested)&lt;/td&gt;
&lt;td&gt;Heavy&lt;/td&gt;
&lt;td&gt;Lightweight&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;Meilisearch is a powerful tool—but like any tool, it performs best when used correctly.&lt;br&gt;
Over time, I’ve learned that keeping the index lean, focusing only on the necessary searchable and filterable attributes, and avoiding overly complex data structures can lead to significantly better performance.&lt;/p&gt;

&lt;p&gt;Configuring things like searchable attributes and filterable fields before indexing goes a long way in keeping everything efficient and smooth.&lt;br&gt;
These aren’t massive changes, but they have a noticeable impact.&lt;/p&gt;

</description>
      <category>meilisearch</category>
      <category>search</category>
      <category>s</category>
    </item>
    <item>
      <title>What the Hash?! Understanding the Basics of Hashing</title>
      <dc:creator>swagath TP</dc:creator>
      <pubDate>Sun, 04 May 2025 17:13:25 +0000</pubDate>
      <link>https://forem.com/swagath_tp_/what-the-hash-understanding-the-basics-of-hashing-25h0</link>
      <guid>https://forem.com/swagath_tp_/what-the-hash-understanding-the-basics-of-hashing-25h0</guid>
      <description>&lt;p&gt;Hashing is an important concept that helps us organize and manage data more efficiently. It's like a shortcut to finding things quickly! &lt;br&gt;
Whether it's for quickly looking up data in hash tables or storing passwords securely, hashing makes sure we can access data quickly and consistently.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore what hashing is, how it works, and the key components behind it.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Hashing?
&lt;/h2&gt;

&lt;p&gt;Hashing is a technique used to convert a given input—such as a string, number, or file—into a unique value, often in the form of a hash code. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb60sve688dgy2lnu8oge.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb60sve688dgy2lnu8oge.jpeg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Hashing for Utility vs. Security
&lt;/h2&gt;

&lt;p&gt;It's also important to know that not all hashing algorithms are built for the same job. Some are designed just to help organize and retrieve data quickly—like the ones used in hash tables or dictionaries. &lt;/p&gt;

&lt;p&gt;These are great when you need fast lookups and don’t care much about security. On the other hand, algorithms like SHA-256 or MD5 are made for security purposes. They’re used when you want to protect sensitive data, like storing passwords or verifying file integrity.&lt;/p&gt;

&lt;p&gt;So basically, if you're building something like a login system, you'd use a secure hash like SHA-256. But if you're just mapping keys to values in a hash table, a simple and fast hash function is all you need.&lt;/p&gt;
&lt;h2&gt;
  
  
  How Hashing Makes Data Lookup Fast
&lt;/h2&gt;

&lt;p&gt;In data structures like hash tables, which store key/value pairs, each piece of data is stored in an array-like structure, and the hashing process helps determine the specific location where each element will go.&lt;/p&gt;

&lt;p&gt;When you want to find or update a value, hashing makes it quick and efficient because it allows for constant-time lookups. Rather than searching through the entire dataset, hashing quickly identifies the location of the data by generating a unique hash code for each key. This unique code is then used as an index to access the corresponding value.&lt;/p&gt;

&lt;p&gt;This method is especially useful for large datasets, as it ensures that lookups, insertions, and deletions happen in nearly constant time, regardless of the size of the data.&lt;/p&gt;
&lt;h2&gt;
  
  
  Components of Hashing
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvjhtnqf88qr8cvxki2rj.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvjhtnqf88qr8cvxki2rj.jpeg" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Keys
&lt;/h4&gt;

&lt;p&gt;A key can be any piece of data, such as a string, number, or file, which is input into the hash function. This key is used to determine where the data will be stored in a hash table.&lt;/p&gt;
&lt;h4&gt;
  
  
  Hash function
&lt;/h4&gt;

&lt;p&gt;We use the hash function to take an input key and generate a unique index, known as the hash index, where the corresponding data will be stored.&lt;br&gt;
It converts the key into an index in the hash table, making it easier to locate and retrieve the data efficiently.&lt;/p&gt;
&lt;h4&gt;
  
  
  Hash table
&lt;/h4&gt;

&lt;p&gt;A hash table is a data structure that stores data by mapping keys to values with the help of a hash function. It organizes the data inside an array, where each value is placed at a specific index generated from its key, making it easy to access the data later.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Hash Collision
&lt;/h2&gt;

&lt;p&gt;A hash collision happens when two different keys are assigned the same index in a hash table. This occurs because the hash function, which calculates where each item should go, might occasionally produce the same result for different inputs.&lt;br&gt;
It's like two people accidentally having the same house number on the same street.&lt;/p&gt;

&lt;p&gt;To handle collisions, hash tables use techniques like placing both items at the same index using a list (chaining), or finding another nearby spot for one of them (open addressing).&lt;/p&gt;

&lt;p&gt;These methods help ensure that even when collisions happen, the data remains accessible and the system continues to work without any issues.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Are Hashing Algorithms?
&lt;/h2&gt;

&lt;p&gt;Basically, a hash algorithm is just a set process that takes any kind of input—like a bit of text, a number, or even a whole file—and turns it into a fixed-length string that looks totally random.&lt;/p&gt;

&lt;p&gt;Regardless of the size of the input, the resulting hash always has a fixed length. And if you give it the same input again, you’ll always get the exact same hash back.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zc7qpzlwxoob1hkyzcd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0zc7qpzlwxoob1hkyzcd.png" alt="Image description" width="800" height="178"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Over the years, plenty of different hashing algorithms have been created—each with its own way of working, along with its pros and cons depending on where it's used.&lt;br&gt;
MD5, SHA, and CRC32 are some of the most popular algorithms used nowadays.&lt;/p&gt;
&lt;h4&gt;
  
  
  MD5 (Message Digest 5)
&lt;/h4&gt;

&lt;p&gt;MD5 was widely used in the past but now it is considered insecure because it can cause collisions (two different inputs giving the same hash).&lt;br&gt;
It’s still used for tasks like checking file integrity but not for sensitive data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import hashlib

def md5_hash(text):
    text_bytes = text.encode('utf-8') 
    hash_object = hashlib.md5(text_bytes)  
    return hash_object.hexdigest() 


user_input = input("Enter text to hash using MD5: ")
hashed = md5_hash(user_input)
print(f"MD5 hash of '{user_input}': {hashed}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4oeo8yksu51in0s5kaf9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4oeo8yksu51in0s5kaf9.png" alt="Image description" width="798" height="132"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a hash function that uses the MD5 algorithm from Python's hashlib module.&lt;br&gt;
MD5 produces a 32-character hexadecimal string. It's fast but not secure for cryptographic use.&lt;/p&gt;
&lt;h4&gt;
  
  
  SHA (Secure Hash Algorithm)
&lt;/h4&gt;

&lt;p&gt;SHA refers to a group of hashing algorithms, with SHA-2 being the most common these days.&lt;br&gt;
It’s trusted for securing private data and is used in applications like blockchain and digital certificates.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import hashlib

def sha256_hash(text):
    text_bytes = text.encode('utf-8')
    hash_object = hashlib.sha256(text_bytes)
    return hash_object.hexdigest()


user_input = input("Enter text to hash using SHA-256: ")
hashed = sha256_hash(user_input)
print(f"SHA-256 hash of '{user_input}': {hashed}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv6xpzarf838rompnhwav.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv6xpzarf838rompnhwav.png" alt="Image description" width="800" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we're using Python's built-in 'hashlib' module&lt;br&gt;
to create a SHA-256 hash of a string entered by the user.&lt;br&gt;
HA-256 produces a 256-bit (32-byte) hash value, represented as a 64-character hexadecimal string.&lt;/p&gt;
&lt;h4&gt;
  
  
  CRC32 (Cyclic Redundancy Check)
&lt;/h4&gt;

&lt;p&gt;CRC32 is mainly used for error checking—like making sure files haven’t been corrupted during download.&lt;br&gt;
It’s quick and easy but not strong enough to protect sensitive data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import zlib

def crc32_hash(text):
    text_bytes = text.encode('utf-8')
    crc = zlib.crc32(text_bytes)
    return format(crc &amp;amp; 0xFFFFFFFF, '08x')

user_input = input("Enter text to hash using CRC32: ")
hashed = crc32_hash(user_input)
print(f"CRC32 hash of '{user_input}': {hashed}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5rmie86r1mxp2pwu4wt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw5rmie86r1mxp2pwu4wt.png" alt="Image description" width="800" height="130"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This function computes the CRC32 checksum of a given input string.&lt;br&gt;
CRC32 is used for error-checking, not for cryptographic purposes.&lt;br&gt;
It returns a 32-bit unsigned integer value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Hashing is More Efficient
&lt;/h2&gt;

&lt;p&gt;Arrays are commonly used to store data and allow fast access by index in O(1) time. However, searching for a specific value—when the index is unknown—takes O(n) time in an unsorted array.&lt;/p&gt;

&lt;p&gt;To address this inefficiency, we use hashing. Hashing enables key-based access in O(1) average time by applying a hash function to the key, which maps it to a specific position in a hash table.&lt;/p&gt;

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

&lt;p&gt;Hashing is a simple but useful technique that helps us store and secure data efficiently.&lt;br&gt;
There are different algorithms depending on what you need, but the core idea stays the same: take some data and turn it into a unique, fixed-size value that’s quick to work with.&lt;/p&gt;

&lt;p&gt;Understanding how hashing works gives us a better idea of what’s happening behind the scenes in apps, websites, and systems we use every day.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>hashing</category>
      <category>hashfunction</category>
      <category>programming</category>
    </item>
    <item>
      <title>React 19: New Hooks Every Developer Should Know</title>
      <dc:creator>swagath TP</dc:creator>
      <pubDate>Sun, 26 Jan 2025 15:53:15 +0000</pubDate>
      <link>https://forem.com/swagath_tp_/react-19-new-hooks-every-developer-should-know-40dl</link>
      <guid>https://forem.com/swagath_tp_/react-19-new-hooks-every-developer-should-know-40dl</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4oh9212q9rqhx9a6yjxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4oh9212q9rqhx9a6yjxr.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
React 19 was officially released on npm on April 25, 2024. &lt;br&gt;
 &lt;br&gt;
 This latest version brings a strong focus on enhancing performance and efficiency, along with exciting features designed to simplify web development and improve overall user experience.&lt;/p&gt;
&lt;h2&gt;
  
  
  What's new?
&lt;/h2&gt;

&lt;p&gt;React 19 has some new features like automatic performance optimizations through the new React Compiler, server side rendering with Server Components for faster load times, enhanced concurrent rendering for smoother user experiences, etc.&lt;br&gt;
One thing that caught my attention is the introduction of some brand-new hooks.&lt;/p&gt;

&lt;p&gt;In this article, we'll look into these new hooks, explore their unique capabilities, and discuss how they can enhance your projects.&lt;/p&gt;
&lt;h2&gt;
  
  
  useTransition-Make slow tasks feel smooth
&lt;/h2&gt;

&lt;p&gt;The useTransition() hook is designed for handling asynchronous operations by keeping your interface smooth and responsive.&lt;br&gt;
It allows you to manage pending states and errors seamlessly, ensuring that your app doesn't freeze or become unresponsive during async tasks.&lt;/p&gt;

&lt;p&gt;Have you ever clicked a button in an app and felt like it froze for a second? &lt;code&gt;useTransition()&lt;/code&gt; can fix that.&lt;br&gt;
It lets React handle loading in the background while keeping the app smooth and interactive. The UI can let users do other things, and when the data is ready, it updates without any delay.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbqm82zt9zcd3mzhuxnpv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbqm82zt9zcd3mzhuxnpv.gif" alt="Image description" width="522" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, you can use it to implement a "delete item" feature where the item disappears from the UI instantly, while the actual deletion happens in the background.&lt;/p&gt;

&lt;p&gt;If the operation fails, useTransition allows you to handle errors gracefully without freezing the input or affecting the user experience, creating a more polished, responsive interface.&lt;br&gt;
It's an essential tool for modern apps, especially when dealing with user interactions that depend on backend operations.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Transition = () =&amp;gt; {
 const [items, setItems] = useState(["Item 1", "Item 2", "Item 3"]);
 const [isPending, startTransition] = useTransition();
 const [error, setError] = useState(null);
const deleteItem = (itemToDelete) =&amp;gt; {
 const updatedItems = items.filter(item =&amp;gt; item !== itemToDelete);
 setItems(updatedItems);
 startTransition(() =&amp;gt; {
 fakeDeleteAPI(itemToDelete)
 .then(() =&amp;gt; {
 console.log(`${itemToDelete} deleted successfully.`);
 })
 .catch((err) =&amp;gt; {
 setError(`Failed to delete ${itemToDelete}: ${err.message}`);
 setItems(items); 
 });
 });
 };
return (
 &amp;lt;div className="trans-container"&amp;gt;
 &amp;lt;h1 className="trans-heading"&amp;gt;Delete Item Example&amp;lt;/h1&amp;gt;
 {error &amp;amp;&amp;amp; &amp;lt;div className="error-message"&amp;gt;{error}&amp;lt;/div&amp;gt;}
 &amp;lt;ul className="item-list"&amp;gt;
 {items.map((item) =&amp;gt; (
 &amp;lt;li key={item} className="item"&amp;gt;
 {item}
 &amp;lt;button className={`delete-button ${isPending ? "loading" : ""}`} onClick={() =&amp;gt; deleteItem(item)}&amp;gt;
 {isPending ? "Processing…" : "Delete"}
 &amp;lt;/button&amp;gt;
 &amp;lt;/li&amp;gt;
 ))}
 &amp;lt;/ul&amp;gt;
 {isPending &amp;amp;&amp;amp; &amp;lt;p className="loading-indicator"&amp;gt;Processing…&amp;lt;/p&amp;gt;}
 &amp;lt;/div&amp;gt;
 );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  useActionState-Manage action states easily
&lt;/h2&gt;

&lt;p&gt;The useActionState() hook is a real-time saver when it comes to managing async actions.&lt;/p&gt;

&lt;p&gt;If you've ever dealt with fetching data from an API or performing background tasks, you know how tricky it can be to track loading states, success, and errors.&lt;/p&gt;

&lt;p&gt;This is where &lt;code&gt;useActionState()&lt;/code&gt; steps in to simplify the process.&lt;br&gt;
It automatically gives you access to the action's pending status, so you can easily show loading spinners or placeholder content while the operation is in progress.&lt;/p&gt;

&lt;p&gt;Once the action is complete, it updates with the latest data, so you don't have to worry about manually managing the state or re-rendering components.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffohvvhjbc56vjxs2di15.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffohvvhjbc56vjxs2di15.gif" alt="Image description" width="522" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For example, imagine you're building a user profile page that fetches user data from an API.&lt;br&gt;
With useActionState, you can automatically display a loading while the data is being fetched, and once the data arrives, it's seamlessly updated on the page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function UserDetails() {
 const [result, formAction, isPending] = useActionState(fetchUser, null);

 return (
 &amp;lt;div className="user-details-container"&amp;gt;
 &amp;lt;h2 className="user-details-heading"&amp;gt;Fetch User Information&amp;lt;/h2&amp;gt;
 &amp;lt;form action={formAction} className="fetch-user-form"&amp;gt;
 &amp;lt;button
 type="submit"
 className={`fetch-user-button ${isPending ? "loading" : ""}`}
 disabled={isPending}
 &amp;gt;
 {isPending ? "Loading…" : "Fetch User Info"}
 &amp;lt;/button&amp;gt;
 &amp;lt;/form&amp;gt;
{isPending ? (
 &amp;lt;div className="loading-indicator"&amp;gt;Loading…&amp;lt;/div&amp;gt;
 ) : result?.success ? (
 &amp;lt;div className="user-details"&amp;gt;
 &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Name:&amp;lt;/strong&amp;gt; {result.details.name}&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Email:&amp;lt;/strong&amp;gt; {result.details.email}&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;Age:&amp;lt;/strong&amp;gt; {result.details.age}&amp;lt;/p&amp;gt;
 &amp;lt;/div&amp;gt;
 ) : result?.message ? (
 &amp;lt;p className="error-message"&amp;gt;{result.message}&amp;lt;/p&amp;gt;
 ) : null}
 &amp;lt;/div&amp;gt;
 );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  useOptimistic-Make the updates feel instant
&lt;/h2&gt;

&lt;p&gt;The useOptimistic() hook is a great tool for handling optimistic UI updates, making your app feel faster and more responsive.&lt;br&gt;
If you've ever clicked a button and waited for a backend response before seeing the UI update.&lt;/p&gt;

&lt;p&gt;This hook allows you to make temporary changes to the UI immediately while waiting for confirmation from the server.&lt;br&gt;
If the backend operation succeeds, the temporary changes are finalized, but if it fails, useOptimistic automatically reverts the changes to maintain data consistency.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8z799un7537sd51tahly.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8z799un7537sd51tahly.gif" alt="Image description" width="522" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this Todo List app, the useOptimistic() hook lets users see new tasks instantly, even before the server confirms them.&lt;/p&gt;

&lt;p&gt;If something goes wrong, like a network issue, the app removes the task and keeps everything in sync, ensuring a smooth and consistent experience for the user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function Todo({ messages, sendMessage }) { 
 const formRef = useRef(); 

 async function formAction(formData) { 
 addOptimisticMessage(formData.get("message")); 
 formRef.current.reset(); 
 await sendMessage(formData); 
 } 

 const [optimisticMessages, addOptimisticMessage] = useOptimistic(
 messages, 
 (state, newMessage) =&amp;gt; [
 …state, 
 { text: newMessage, sending: true }
 ]
 );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By eliminating the delay between user actions and UI feedback, &lt;code&gt;useOptimistic()&lt;/code&gt; creates a snappier and more engaging user experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use-Simplify complex async workflows
&lt;/h2&gt;

&lt;p&gt;The use() hook simplifies working with asynchronous resources, like promises and context, directly within the render phase.&lt;br&gt;
Traditionally, managing async data in React required a combination of useEffect, useState, and conditional rendering for loading states.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6a35pbhizxur936w84g1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6a35pbhizxur936w84g1.gif" alt="Image description" width="522" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;use()&lt;/code&gt;, you can now fetch data or consume async resources seamlessly without juggling multiple hooks or adding unnecessary complexity to your components.&lt;/p&gt;

&lt;p&gt;It's like cutting out the middleman and letting React handle async workflows natively.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function UsersList({ promise }) {
 const users = use(promise);
 return (
 &amp;lt;div&amp;gt;
 &amp;lt;h1&amp;gt;User List&amp;lt;/h1&amp;gt;
 &amp;lt;ul&amp;gt;
 {users.map((user) =&amp;gt; (
 &amp;lt;li key={user.id}&amp;gt;{user.name}&amp;lt;/li&amp;gt;
 ))}
 &amp;lt;/ul&amp;gt;
 &amp;lt;/div&amp;gt;
 );
}
export default function App() {
 const [userPromise, setUserPromise] = useState(null);
 const handleLoadUsers = () =&amp;gt; {
 setUserPromise(fetchUsers());
 };
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For instance, instead of using useEffect to fetch user data and update the state once the data arrives, you can now call the async function directly in your render code using use.&lt;/p&gt;

&lt;p&gt;React will automatically pause rendering until the promise resolves, ensuring your UI updates only when the data is ready.&lt;br&gt;
This not only simplifies your code but also makes it easier to reason about your components' behavior.&lt;/p&gt;

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

&lt;p&gt;The new hooks like &lt;code&gt;useTransition()&lt;/code&gt;, &lt;code&gt;useActionState()&lt;/code&gt;, &lt;code&gt;useFormStatus()&lt;/code&gt;, &lt;code&gt;useOptimistic()&lt;/code&gt;, and &lt;code&gt;use()&lt;/code&gt; will make development much more efficient.&lt;/p&gt;

&lt;p&gt;They make coding simpler, save time by cutting out repetitive tasks, and improve the UI smoother.&lt;/p&gt;

&lt;p&gt;Most importantly, they help create a better user experience, making apps faster, and more responsive. With these hooks, you'll find building modern, user-friendly applications quicker and more efficient than ever.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
