<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muhammad Sameer</title>
    <description>The latest articles on DEV Community by Muhammad Sameer (@sameer472).</description>
    <link>https://dev.to/sameer472</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%2F906415%2F7623b650-67b4-41e8-a4ef-6838c283c07e.jpg</url>
      <title>DEV Community: Muhammad Sameer</title>
      <link>https://dev.to/sameer472</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sameer472"/>
    <language>en</language>
    <item>
      <title>What the hell is Closure in JS?</title>
      <dc:creator>Muhammad Sameer</dc:creator>
      <pubDate>Tue, 23 Jul 2024 19:24:36 +0000</pubDate>
      <link>https://dev.to/sameer472/what-the-fk-is-closure-in-js-1j4o</link>
      <guid>https://dev.to/sameer472/what-the-fk-is-closure-in-js-1j4o</guid>
      <description>&lt;p&gt;Solid defination as per doc&lt;br&gt;
"&lt;em&gt;A closure is a combination of function bundled together with references to its surronding state (the lexical enviromenet). In other words closure  give access to outer function scope from inner function&lt;/em&gt;."&lt;/p&gt;

&lt;p&gt;No i am going to break down this defination in detail step by step and I believe after reading this blog you will never get confused while giving answer to closure in your next interview.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A closure is a combination of function bundled together with references to its surronding state (the lexical enviromenet)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;okey so what does it mean I am writing a JS code then you will get idea what does it mean !&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function outerFunction(){

    // lexical enviroment 
    console.log("outer function")
    function innerFunction(){
        console.log("inner function ")
    }
    // lexical enviroment 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inner functions and Outer function are combination of two functions Ineer function is enclosed in the &lt;strong&gt;lexical enviroment&lt;/strong&gt; of Outer function.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In other words closure  give access to outer function scope from inner function&lt;/strong&gt;&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%2F502uy0krcv1cz0gx0043.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%2F502uy0krcv1cz0gx0043.png" alt="code snippet" width="800" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;aha now you get the defination that how the innerFunction take access to outerfunction scope by printing the name variable Sameer in inner Function we are going to deep dive more.&lt;/p&gt;

&lt;p&gt;Inner Function take &lt;strong&gt;reference&lt;/strong&gt; to OuterFunction variable i repeat take &lt;strong&gt;reference&lt;/strong&gt; let me show you how !&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%2Fezzprpud2i8pj8cehpb9.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%2Fezzprpud2i8pj8cehpb9.png" alt="code snippet" width="800" height="291"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have update the name after the innerFunction you might be thinking its going to print name Sameer in console but No as i said it takes the &lt;strong&gt;reference&lt;/strong&gt; of the variable not going to create a new memory in a stack just take the &lt;strong&gt;reference&lt;/strong&gt; of the variable that what a closure is.&lt;/p&gt;

&lt;p&gt;You noticed something i am envoking a innerFunction in OuterFunction scope and then envoking a OuterFunction. &lt;/p&gt;

&lt;p&gt;remember innerFunction always remember or maintined the reference of outer enviroment even after the execution of outerFunction see an example below in a code where i first execute a outerFunction and then calling a innerFunction.&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%2Fey64ifj792km3f64x18i.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%2Fey64ifj792km3f64x18i.png" alt="code snippet" width="800" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro Tip🚀&lt;/strong&gt;&lt;br&gt;
An inner function can be directly called using two parenthesis ()() check code i mentioned.&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%2Fnk7ukjns4jqkq5r6hl7u.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%2Fnk7ukjns4jqkq5r6hl7u.png" alt="code snippet" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use case of closures&lt;/strong&gt;&lt;br&gt;
Closures can also be used for encapsulate data by allowing you to create private variables that are not be accessible from outside the scope that can only accessed or modified through specific functions .&lt;/p&gt;

&lt;p&gt;here is the perfect example of code where we are modifying the values of counter with only the specific provided functions.&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%2Fg9e07a6gmygkluy8fvtn.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%2Fg9e07a6gmygkluy8fvtn.png" alt="code snippet" width="800" height="336"&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Okay now i have a question for you what if i create a new reference of the function and then again ivoke the incrementCounter guess !! lets look in the 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%2Fyt9bde4bylrj0633sdod.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%2Fyt9bde4bylrj0633sdod.png" alt="code snippet" width="800" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;hell Yes.. The counter is getting start from 0 and you know the answer right. &lt;/p&gt;

&lt;p&gt;I hope now you got familiar with the closures and you can easily cracked interview questions about closure in JS.&lt;/p&gt;

&lt;p&gt;well thats for it and I see you in the next one.😉 &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>frontend</category>
      <category>react</category>
      <category>webdev</category>
    </item>
    <item>
      <title>What is GraphQl?</title>
      <dc:creator>Muhammad Sameer</dc:creator>
      <pubDate>Tue, 25 Jun 2024 12:16:58 +0000</pubDate>
      <link>https://dev.to/sameer472/what-is-graphql-1bec</link>
      <guid>https://dev.to/sameer472/what-is-graphql-1bec</guid>
      <description>&lt;p&gt;Order What You Want: Imagine you’re at a restaurant. With GraphQL, you can order exactly what you want from the menu, and you get just that. You don’t get a whole meal if you only wanted a drink.&lt;/p&gt;

&lt;p&gt;Hope you get what I am trying to say. So basically GraphQl is a query Lanuage for API. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools. &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%2Fj8k5pvt5kczmxwzdbweg.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%2Fj8k5pvt5kczmxwzdbweg.png" alt="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j8k5pvt5kczmxwzdbweg.png" width="800" height="215"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Graphql is often confused with being a database. This is a mis conceptuation &lt;strong&gt;Graphql is just a query language for APIs&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benifits of Using Graphql over REST API&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Precise Data Fetching:&lt;/strong&gt;&lt;br&gt;
 You can request exactly the data you need and nothing more. This reduces the amount of data transferred over the network, making your app faster and more efficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Single Endpoint:&lt;/strong&gt;&lt;br&gt;
 GraphQL uses a single endpoint to handle all types of queries, mutations, and subscriptions, simplifying the API structure and reducing complexity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Nested and Related Data:&lt;/strong&gt;&lt;br&gt;
 You can fetch related data in a single request, avoiding the need for multiple API calls. This is particularly useful for complex applications with interconnected data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Real-time Data:&lt;/strong&gt;&lt;br&gt;
 GraphQL supports subscriptions, allowing clients to receive real-time updates when data changes. This is useful for applications that need to display live data, such as chat apps or live sports scores.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Quick guide about Layer 2 scaling solutions</title>
      <dc:creator>Muhammad Sameer</dc:creator>
      <pubDate>Fri, 16 Jun 2023 06:54:19 +0000</pubDate>
      <link>https://dev.to/sameer472/quick-guide-about-layer-2-scaling-solutions-5d9p</link>
      <guid>https://dev.to/sameer472/quick-guide-about-layer-2-scaling-solutions-5d9p</guid>
      <description>&lt;p&gt;Layer 2 refers to a secondary framework or protocol that is built on top of an existing blockchain system. Major cryptocurrency networks such as Ethereum face transaction speed and scaling difficulties. Bitcoin and Ethereum are still not able to process thousands of transactions per second. Additionally, these layer 2 solutions usually offer much better transaction fees.&lt;/p&gt;

&lt;p&gt;Layer 2 solutions are designed to address the scalability limitations of the Layer 1 blockchain networks. By moving some of the computational and transactional processes off-chain while leveraging the security of the underlying Layer 1 network, Layer 2 solutions can significantly increase transaction throughput, reduce fees, and enhance the overall efficiency of blockchain systems. &lt;/p&gt;

&lt;p&gt;There are two dimensions layer 2 is different from layer 1&lt;br&gt;
first is transection execution and second is data availability&lt;/p&gt;

&lt;p&gt;1) Transaction execution strategies deal with how transactions are run, where they are run, what the trust environments are, what the security and decentralization environments are, etc.&lt;/p&gt;

&lt;p&gt;2) Data availability strategies deal with whether or not the Layer 2 solution makes their transaction data available on the main Layer 1 chain or not.&lt;/p&gt;

&lt;p&gt;Types of Layer 2 Scaling Solutions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;State Channel&lt;/li&gt;
&lt;li&gt;Side Chains&lt;/li&gt;
&lt;li&gt;RollUps
Optimistic Rollups (ORs)
Zero-Knowledge Rollups (ZKRs)&lt;/li&gt;
&lt;li&gt;Palsma&lt;/li&gt;
&lt;li&gt;Validiums&lt;/li&gt;
&lt;li&gt;Voliltions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While Layer 2 scaling solutions offer significant advantages, there are some considerations and challenges to keep in mind:&lt;br&gt;
Security: Layer 2 solutions rely on the security of the underlying Layer 1 blockchain. Ensuring the integrity and safety&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to upload files on IPFS infura.io using React.</title>
      <dc:creator>Muhammad Sameer</dc:creator>
      <pubDate>Sat, 20 Aug 2022 06:15:16 +0000</pubDate>
      <link>https://dev.to/sameer472/how-to-upload-files-on-ipfs-infuraio-using-react-56g</link>
      <guid>https://dev.to/sameer472/how-to-upload-files-on-ipfs-infuraio-using-react-56g</guid>
      <description>&lt;p&gt;&lt;strong&gt;After infura has depreciated the public gateway lots of developers face issues while uploading files on the IPFS infura.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Things we are going to do.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;we will create and setup our infura account &lt;/li&gt;
&lt;li&gt;we will upload files on IPFS &lt;/li&gt;
&lt;li&gt;we access content from the IPFS.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting up the infura account.
&lt;/h2&gt;

&lt;p&gt;Go to the official website &lt;a href="https://infura.io/" rel="noopener noreferrer"&gt;infura.io&lt;/a&gt; and create a new account if you don't have it after creating and signing it click on the &lt;strong&gt;create new key&lt;/strong&gt;.&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%2Fv7eetvoy1l27gnbzgbei.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%2Fv7eetvoy1l27gnbzgbei.png" alt="Dashboard of the infura" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select the network IPFS and mention name of the Project whatever you want and create it.&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%2F29pf0mg54scrfpfo49ae.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%2F29pf0mg54scrfpfo49ae.png" alt="a card showing a options to select network and name of the project" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you will see following credential here project secret key , API Key secret and IPFS endpoint one more thing we want here is dedicated gateway domain link so we will get it by enabling the dedicated gateway option enter the name of the domain on your own choice and save the domain.&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%2Fkpxftaoye6tcfyu1a5qu.jpg" 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%2Fkpxftaoye6tcfyu1a5qu.jpg" alt="image showing the project summary." width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;now you have setup your account and now you have your own dedicated gateway we will use all these credential in our project later on.&lt;/p&gt;
&lt;h2&gt;
  
  
  How to Upload files on IPFS in your project.
&lt;/h2&gt;

&lt;p&gt;In your React project we need npm package called ipfs-http-client install it using this command.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i ipfs-http-client&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Open App.js file in your react project and import the ipfs-http-client we are importing &lt;code&gt;create&lt;/code&gt; function as &lt;code&gt;ipfsHttpClient&lt;/code&gt; provided by the &lt;code&gt;ipfs-http-client&lt;/code&gt; and set up your infura credential in your react project.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { create as ipfsHttpClient } from "ipfs-http-client";&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
add up your infura keys in your App.js component we will use them to generate the authorization key by generating the &lt;code&gt;base64&lt;/code&gt; key using the function &lt;code&gt;btoa&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;const projectId = "&amp;lt;YOUR PROJECT ID&amp;gt;";
const projectSecret = "&amp;lt;YOUR PROJECT SECRET&amp;gt;";
const authorization = "Basic " + btoa(projectId + ":" + projectSecret);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: feel free to use environment variable for the safer alternative&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now we will create a variable &lt;code&gt;ipfs&lt;/code&gt; this will store the ipfs http client return by the &lt;code&gt;create&lt;/code&gt; function. we are going to pass the argument in &lt;code&gt;create&lt;/code&gt; function include &lt;code&gt;url&lt;/code&gt; and the &lt;code&gt;headers&lt;/code&gt; include &lt;code&gt;authorization&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;   const ipfs = create({
      url: "https://ipfs.infura.io:5001/api/v0",
      headers:{
        authorization
      }
    })
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;after established the connection with &lt;strong&gt;IPFS&lt;/strong&gt; we will upload files from our input form.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    &amp;lt;div className="App"&amp;gt;
      {ipfs &amp;amp;&amp;amp; (
        &amp;lt;&amp;gt;
          &amp;lt;h3&amp;gt;Upload file to IPFS&amp;lt;/h3&amp;gt;
          &amp;lt;form onSubmit={onSubmitHandler}&amp;gt;
            &amp;lt;input type="file" name="file"/&amp;gt;
            &amp;lt;button type="submit"&amp;gt;Upload file&amp;lt;/button&amp;gt;
          &amp;lt;/form&amp;gt;
        &amp;lt;/&amp;gt;
      )}
    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;onSubmitHandler&lt;/code&gt; is the main function which will take care of all the implementation lets write the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const onSubmitHandler = async (event) =&amp;gt; {
    event.preventDefault();
    const form = event.target;
    const files = (form[0]).files;

    if (!files || files.length === 0) {
      return alert("No files selected");
    }

    const file = files[0];
    // upload files
    const result = await ipfs.add(file);

    setImages([
      ...images,
      {
        cid: result.cid,
        path: result.path,
      },
    ]);

    form.reset();
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Logic of this function is straight forward&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Verify the file if selected otherwise show the alert message file is not selected&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;ipfs.add(file)&lt;/code&gt; is uploading file to IPFS&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;add&lt;/code&gt; method returns the following properties include &lt;code&gt;cid&lt;/code&gt; , &lt;code&gt;path&lt;/code&gt; , &lt;code&gt;size&lt;/code&gt; and &lt;code&gt;mtime&lt;/code&gt; the most important properties are &lt;code&gt;cid&lt;/code&gt; (it is the content identifier or unique content identifer given to the uploaded files) and &lt;code&gt;path&lt;/code&gt;(which we will use to display files). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;we will update the state of the images by adding the new files&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;add this line in the beginning of the component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const [images, setImages] = useState([])

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Displaying the uploaded files from the IPFS
&lt;/h2&gt;

&lt;p&gt;We have our logic already implemented in the onSubmitHandler function now we are going to use this logic in our jsx&lt;br&gt;
lets add the template to display the files and one more thing todo in the last copy the dedicated gateway domain link from the Infura API key and replace it with the &lt;code&gt;dedicated-gateway-link&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;&amp;lt;div&amp;gt;
        {images.map((image, index) =&amp;gt; (
          &amp;lt;img
          alt={`Uploaded #${index + 1}`}
          src={"&amp;lt;dedicated-gateway-link&amp;gt;/ipfs/" + image.path}
            style={{ maxWidth: "400px", margin: "15px" }}
            key={image.cid.toString() + index}
          /&amp;gt;
        ))}
      &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have succussfully implemented all the things you can check the complete code in this &lt;a href="https://github.com/Sameer-472/Infura-ipfs-storage" rel="noopener noreferrer"&gt;Github repo&lt;/a&gt;.&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%2Fsqj9q41weelcitcm5h3w.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%2Fsqj9q41weelcitcm5h3w.png" alt="final result of the project" width="774" height="560"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;You have learned how to setup a infura project upload files and access it in your React application. However IPFS innovative concept of being a decentralized solution to store files using a peer-to-peer storage network.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>react</category>
      <category>ipfs</category>
    </item>
  </channel>
</rss>
