<?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: MonicaAcha2103</title>
    <description>The latest articles on Forem by MonicaAcha2103 (@monicaacha2103).</description>
    <link>https://forem.com/monicaacha2103</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%2F845011%2Faa7bd741-594c-4f5d-a146-fb429e1ff343.png</url>
      <title>Forem: MonicaAcha2103</title>
      <link>https://forem.com/monicaacha2103</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/monicaacha2103"/>
    <language>en</language>
    <item>
      <title>What's next in React Native ? ( 2022 and beyond )</title>
      <dc:creator>MonicaAcha2103</dc:creator>
      <pubDate>Sat, 27 Aug 2022 17:23:00 +0000</pubDate>
      <link>https://forem.com/monicaacha2103/react-native-latest-version-updates-2022-2ach</link>
      <guid>https://forem.com/monicaacha2103/react-native-latest-version-updates-2022-2ach</guid>
      <description>&lt;h2&gt;
  
  
  Versions:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Version 0.68&lt;/strong&gt;- is the release version to opt in switch for new architecture. This makes the new architecture open to early adopters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Version 0.69 [LATEST]&lt;/strong&gt;- is the first release to support React 18. It is enabled by default. You can opt out of react 18 by changing one line.&lt;/p&gt;

&lt;p&gt;To know more about react 18, check out my previous blog post&lt;br&gt;
&lt;a href="https://dev.to/monicaacha2103/all-you-need-to-know-about-react-18-dbc"&gt;https://dev.to/monicaacha2103/all-you-need-to-know-about-react-18-dbc&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Version 0.70 [NEXT]&lt;/strong&gt; : this version will ship with Hermes as the default engine.&lt;br&gt;
We can expect new architecture to be released in upcoming versions.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Legacy architecture [&amp;lt; v0.70]&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Native Code&lt;/strong&gt;: Most of the iOS native code is written in Swift/Objective C . Likewise, Android native is written in Java/Kotlin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Javascript VM:&lt;/strong&gt; The virtual machine that runs all the javascript code.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;iOS- React Native uses &lt;strong&gt;JavaScriptCore&lt;/strong&gt; provided by the iOS platform&lt;/p&gt;

&lt;p&gt;Android - React Native bundles the &lt;strong&gt;JavaScriptCore&lt;/strong&gt; along with the application. This increases the app size. Hence the Hello World application of RN would take around 3 to 4 megabytes for Android.&lt;/p&gt;

&lt;p&gt;Web (Chrome) - In case of Chrome debugging mode, the JavaScript code runs within Chrome itself (instead of the JavaScriptCore on the device) and communicates with native code via WebSocket. Here, it will use the &lt;strong&gt;V8 engine.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fu3u9qdbvwmpdts28nk0h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fu3u9qdbvwmpdts28nk0h.png" alt="Legacy Architecture Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Three main fundamentals- Threading Model, Bridge and UI Native Module&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;React Native Bridge&lt;/strong&gt;- React Native bridge is a C++/Java bridge which is responsible for communication between the native and Javascript thread. A custom protocol is used for message passing. It serializes all the data that has to be passed from JS layer to native layer. The native layer then deserializes the data and performs required operations- what views to load, what information is to be retrieved from the hardware, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;UI Modules&lt;/strong&gt;- Native module that maps JSX Views onto Native Views.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Threading Model&lt;/strong&gt;-&lt;br&gt;
When a React Native application is launched, it spawns up the following threading queues-&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Main thread&lt;/strong&gt; &lt;em&gt;(Native Modules)&lt;/em&gt; - This is the main thread which gets spawned as soon as the application launches. It loads the app and starts the JS thread to execute the Javascript code. The native thread also listens to the UI events like 'press', 'touch', etc. These events are then passed to the JS thread via the RN Bridge. Once the Javascript loads, the JS thread sends the information on what needs to be rendered onto the screen. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Shadow thread&lt;/strong&gt; - This information is used by a shadow node thread to compute the layouts. The shadow thread is like a mathematical engine which finally decides on how to compute the view positions. These instructions are then passed back to the &lt;strong&gt;main thread&lt;/strong&gt; to render the view.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Javascript thread&lt;/strong&gt; - The Javascript Queue is the thread queue where main bundled JS thread runs. The JS thread runs all the business logic, i.e., the code in React Native.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Custom Native Modules&lt;/strong&gt; - Apart from the threads spawned by React Native, we can also spawn threads on the custom native modules we build to speed up the performance of the application. For example - Animations are handled in React Native by a separate native thread to offload the work from the JS thread.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Limitations of Old Architecture&lt;/strong&gt;-&lt;br&gt;
Asynchronous, Single threaded , Data Serialization costs when using Bridge&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;New Architecture [v0.70 onwards]-&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hermes Engine -&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of the crucial point of the new architecture rollout is the adoption of the new JavaScript engine- Hermes. React Native 0.70 will ship with Hermes as the default engine. Can be opted out if there is a need to use older VMs like JavascriptCore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript Interface -&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The communication between JavaScript and the VM is being standardized using a JavaScript Interface (&lt;strong&gt;JSI&lt;/strong&gt;). &lt;strong&gt;JSI&lt;/strong&gt; makes it possible for Native components and JS to communicate with each other. It replaces the React Native Bridge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Turbo Modules&lt;/strong&gt; -&lt;br&gt;
TurboModules are the next iteration on Native Modules.It speeds up the way Native Modules are initialised and invoked from JavaScript. It addresses the async and loading issues because they behave in a synchronous way in JavaScript and lazy load into memory, allowing the app to start faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Codegen&lt;/strong&gt; -&lt;br&gt;
Codegen addresses the problem with type safety, because it allows us to generate interfaces we can use to make sure our native code stays in sync with the data we are passing in from the JavaScript layer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fabric -&lt;/strong&gt;&lt;br&gt;
The new architecture uses a new rendering system, &lt;strong&gt;Fabric Renderer&lt;/strong&gt; which has improvements in the rendering layer i.e UI's responsiveness.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fabric Components&lt;/strong&gt; are the preferred way to create reusable UI components, providing a native experience to the users. This will help reduce the overload of application architectures, and your applications will run faster than older cross-platform ones.&lt;/p&gt;

&lt;p&gt;Fabric uses &lt;strong&gt;JSI&lt;/strong&gt; to expose methods to JavaScript code. This will help reduce the overload of application architectures, and your applications will run faster than older cross-platform ones.&lt;/p&gt;

&lt;p&gt;Fabric uses a &lt;strong&gt;single thread&lt;/strong&gt; , will help the UI to communicate via callbacks via JavaScript.&lt;/p&gt;

&lt;p&gt;We've often seen cross-platform applications struggle with the gap between shared code and native environments. To improve the flow of data and debug such errors, you need your own bridges. Fabric will provide a simplified &lt;strong&gt;native bridge&lt;/strong&gt; between JS and frameworks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Improvements in the new architecture -&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Efficient communication between JS and OS platforms&lt;/li&gt;
&lt;li&gt;Improved user experience through highly reactive user interfaces&lt;/li&gt;
&lt;li&gt;Better code sharing with debugging capabilities&lt;/li&gt;
&lt;li&gt;Fast loading of mobile applications&lt;/li&gt;
&lt;li&gt;Synchronous Executions&lt;/li&gt;
&lt;li&gt;Faster build&lt;/li&gt;
&lt;li&gt;Concurrency&lt;/li&gt;
&lt;li&gt;Less overhead of data serialization&lt;/li&gt;
&lt;li&gt;Type Safety&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>reactnative</category>
      <category>architecture</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>All you need to know about React 18</title>
      <dc:creator>MonicaAcha2103</dc:creator>
      <pubDate>Sun, 10 Apr 2022 10:59:03 +0000</pubDate>
      <link>https://forem.com/monicaacha2103/all-you-need-to-know-about-react-18-dbc</link>
      <guid>https://forem.com/monicaacha2103/all-you-need-to-know-about-react-18-dbc</guid>
      <description>&lt;p&gt;ReactJS is the highly used open-source JavaScript Library which makes building dynamic websites easier. This blog post mainly focuses on the latest changes in React's newest version.  A prior knowledge of React and its fundamentals is necessary to understand it to the fullest. &lt;/p&gt;

&lt;h2&gt;
  
  
  Updates on Client Side
&lt;/h2&gt;

&lt;p&gt;Things to update to support the new version. &lt;br&gt;
Updating from React 17 to 18 doesn't involve any breaking changes. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Install package&lt;br&gt;
&lt;code&gt;npm install react@18 react-dom@18&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ReactDOM.render is no longer supported in React 18. Use the new createRoot API instead.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;del&gt;&lt;code&gt;reactDOM.render(&amp;lt;App /&amp;gt;,document.getElementById(‘root’));&lt;/code&gt;&lt;/del&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom/client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; 
&lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/App&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;)&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
Changes in Render callback&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The render callback is removed from the new root API. But &lt;br&gt;
we can pass it as a property to the root component.&lt;br&gt;
&lt;code&gt;root.render(&amp;lt;/App callback={() =&amp;gt; console.log("rendered")}&amp;gt;);&lt;/code&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Updates on Server Side
&lt;/h2&gt;

&lt;p&gt;There are some updates on &lt;strong&gt;react-dom/server&lt;/strong&gt; API's to support suspense and streaming the server side page&lt;br&gt;
&lt;del&gt;&lt;code&gt;renderToString(React.Node)&lt;/code&gt;&lt;/del&gt;&lt;br&gt;
&lt;code&gt;renderToPipeableStream(React.Node, options)&lt;/code&gt;&lt;/p&gt;


&lt;h1&gt;
  
  
  Improvements
&lt;/h1&gt;
&lt;h3&gt;
  
  
  1. Automatic Batching support for async calls
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What is batching?&lt;/strong&gt;&lt;br&gt;
 Multiple setState calls gets combined together and then re-render only once. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is it needed?&lt;/strong&gt;&lt;br&gt;
Fewer re-renders for better performance.&lt;/p&gt;

&lt;p&gt;Before this update, the automatic batching was applied to all state updates in React event handlers. But after the update, it supports async functions as well.&lt;br&gt;
For the below snippet, the re-render would happen thrice. But with the update, it groups and re-render only once.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/someapi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;then&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nx"&gt;setIsFetching&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="nx"&gt;setError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="nx"&gt;setFormStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;success&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Can we opt out of automatic batching?&lt;/strong&gt;&lt;br&gt;
YES. Usually, batching is safe, but some code may depend on reading something from the DOM immediately after a state change. For those use cases, you can use ReactDOM.flushSync() to opt out of batching.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;flushSync&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="err"&gt;‘&lt;/span&gt;&lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;dom&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;flushSync&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="c1"&gt;// wraps state updates &lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Support for Suspense in Server Side Rendering (SSR)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What is SSR?&lt;/strong&gt;&lt;br&gt;
A technique were you render the HTML output of your React component and send the HTML from the server. So that the user has some UI to look at while the Javascript bundles are loading and before it becomes interactive.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Suspense?&lt;/strong&gt;&lt;br&gt;
Suspense is a concept to show a placeholder/ fallback component until the component is ready.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Suspense&lt;/span&gt; &lt;span class="nx"&gt;fallback&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Loader&lt;/span&gt;&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; &lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Component&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Suspense &lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before v18, Suspense was introduced into react in 16.6v (2018) limiting only to client-side .On server side, it would render all or nothing to the user, impacting the performance.&lt;br&gt;
After v18, It provides support to render the website faster and improves the initial load time. &lt;/p&gt;
&lt;h3&gt;
  
  
  3. Concurrency
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;What is Concurrency ?&lt;/strong&gt;&lt;br&gt;
Simply means interrupting an ongoing task.&lt;br&gt;
We can tell React which updates are less urgent and can be delayed.&lt;br&gt;
Urgent state updates can be prioritised over less priority updates.&lt;/p&gt;

&lt;p&gt;Previously state updates order in which they were triggered.&lt;br&gt;
With v18, we can change the priority using new API's called &lt;strong&gt;Concurrent Features&lt;/strong&gt;-&lt;br&gt;
&lt;strong&gt;1. useTransition()&lt;/strong&gt;&lt;br&gt;
  Used in functional components . &lt;br&gt;
If there are 2 consecutive state updates, it may block the rendering of the UI, if the any of the update is expensive . So we can lower the priority of the state updates by wrapping them in useTransition&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;isPending&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;startTransition&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useTransition&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;setInputValue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
&lt;span class="nx"&gt;startTransition&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="c1"&gt;//less priority&lt;/span&gt;
 &lt;span class="nx"&gt;setResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;results&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isPending&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Spinner&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. useDeferredValue()  -&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Tell React to show older value, until the new value is ready  similar to startTransition but cannot be used in cases where you don’t have full control over state update. Maybe the state update is happening in other 3rd party library and you just have the updated value.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const deferredVal = useDeferredValue(stateValue)&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  New APIS for library developers
&lt;/h2&gt;

&lt;p&gt;(As application developer, we might not need these)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;useSyncExternalStore  - is a new hook that allows external stores to support concurrent reads.&lt;/li&gt;
&lt;li&gt;useInsertionEffect - is a new hook that allows CSS-in-JS libraries.&lt;/li&gt;
&lt;li&gt;useId - is a new hook that generates unique ids for components. Useful for design systems&lt;/li&gt;
&lt;/ol&gt;




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

&lt;p&gt;These new features makes the websites faster, giving a good user experience and optimises the performance mainly in SSR. &lt;br&gt;
Things to look forward to in the upcoming versions - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Suspense supporting data fetching where manually rendering the fallback component is taken care by React itself.&lt;/li&gt;
&lt;li&gt;Server components (alpha stage) to use React components on server side. &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>advanced</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
