<?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: Suman Roy</title>
    <description>The latest articles on DEV Community by Suman Roy (@suman373_30).</description>
    <link>https://dev.to/suman373_30</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%2F906658%2F466e533f-26fa-4e52-a57b-9bb4ba9a7fd0.png</url>
      <title>DEV Community: Suman Roy</title>
      <link>https://dev.to/suman373_30</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/suman373_30"/>
    <language>en</language>
    <item>
      <title>Theoretical Aspects of API</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Wed, 25 Jan 2023 14:06:19 +0000</pubDate>
      <link>https://dev.to/suman373_30/theoretical-aspects-of-api-2l70</link>
      <guid>https://dev.to/suman373_30/theoretical-aspects-of-api-2l70</guid>
      <description>&lt;p&gt;API is an acronym that stands for Application Programming Interface. It is a collection of communication protocols used by various applications to communicate between them. A programmer can make use of various API tools to make its program easier and simpler. Thus, in simple terms it acts as a bridge between two programs or applications to handle information and resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-life example of API&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let us take an example of when we are searching for a movie on a website like Netflix or something. We select the category of the movie and then all the movies are displayed on our screen for the genre. Well, this is all because our application/ device communicated and exchanged data with another application/program which is called server. Now, this server selects all the movies that suits the genre we selected, and sends them from the database to our screen.&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%2Flprukybrkm2iwmqofbc5.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%2Flprukybrkm2iwmqofbc5.png" alt="image1" width="301" height="167"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of APIs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web APIs&lt;/strong&gt; - Web APIs are the apis which helps all the softwares and applications running on the web and they are easily accessible by HTTP protocols. These are extensively used in modern softwares around us.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local APIs&lt;/strong&gt;- These APIs generally offer middleware services or OS to applications. Local APIs have access to individual application components , which means that the delivery of services and information is more flexible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Program APIs&lt;/strong&gt; - Program APIs helps run a remote program in the local machine by using RPC's (Remote Procedural Calls)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hardware APIs&lt;/strong&gt; - They are a representation of hardware components on the software level. It allows us to automatically derive a hardware structure based on access patterns in software itself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Protocols and Architecture&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Enterprises increasingly rely on APIs to interact with customers and their partners. It is quite important which type of API is right for the needs before starting the development of service or the product.&lt;/p&gt;

&lt;p&gt;APIs require clear architecture and protocols . These are the rules, structures and constraints that govern an API's operation. Today, there are three categories of API protocols or architectures: REST, RPC and SOAP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;REST&lt;/strong&gt; - It stands for Representational State Transfer, is the most popular architecture for builiding APIs among the others. It relies on a client/server approach that separates front-end and back -end of the API and provides considerable flexibility in development and implementation of the application. REST is stateless, which means the API stores no data or status between requests. It also supports caching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SOAP&lt;/strong&gt; - It stands for Simple Object Access Protocol, is a messaging standard defined by the World Wide Web Consortium and broadly used to create web APIs, usually with XML (extensible markup language) . SOAP supports a wide range of communication protocols found across the internet, such as HTTP, SMTP and TCP/IP. It is style-independent, which enables developers to write SOAP APIs in varied ways and easily add features and functionality. It is tightly controlled with clearly defined standards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RPC&lt;/strong&gt; - It stands for Remote Procedural Calls, is a simple means to send multiple parameters and receive results, similar client/server approach like REST. RPC invokes executable actions or processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advantages of using APIs&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;They make our product more efficient by reducing the needs of complex code or programs which gets difficult to maintain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Flexibility is what makes it developer-friendly. Programmers can ask or integrate services as per their requirements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As APIs are running by computers, they are more reliable than humans (more prone to making mistakes) and automates the process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;New functionalities can be easliy implemented.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&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%2Fgjfyojnzka0bn3c4vjyd.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%2Fgjfyojnzka0bn3c4vjyd.png" alt="rest api" width="344" height="146"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Coming to the disadvantages, there are few of them. They are as follows :&lt;/p&gt;

&lt;p&gt;They are not cost effective. Most of the times the APIs are quite costly, needs high maintanence and developer support.&lt;/p&gt;

&lt;p&gt;Since they are the means of sending and receiving data, this layer of the software is prone to cyber attacks from hackers.&lt;/p&gt;




&lt;p&gt;This is the end of the blog. I hope it cleared the basic understanding of the basic concepts of API and would help to integrate one in your project soon.&lt;/p&gt;

&lt;p&gt;You can connect with me on : &lt;br&gt;
&lt;a href="https://www.linkedin.com/in/sumanroy369" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Suman373" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/sumanroy369" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>productivity</category>
      <category>database</category>
      <category>cloud</category>
    </item>
    <item>
      <title>From React in web to react in mobile</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Mon, 23 Jan 2023 14:07:28 +0000</pubDate>
      <link>https://dev.to/suman373_30/my-first-experience-with-react-native-2jj2</link>
      <guid>https://dev.to/suman373_30/my-first-experience-with-react-native-2jj2</guid>
      <description>&lt;p&gt;Transitioning from one domain to another is often overwhelming and confusing, whether you are looking for a job switch or want to get your hands dirty with certain technologies or like me, wants to explore.&lt;/p&gt;

&lt;p&gt;In this blog, I'll briefly share how I got started with my first mobile app project. The problems I faced and the fixes.&lt;/p&gt;

&lt;p&gt;In the beginning, I personally started with the simplest things like HTML, CSS and JS . With time I wanted to get started with MERN stack so, as suggested by most experienced people I learnt React and it didn't stop there. It took me couple months to be able to make a project with both client in React and server in Node , MongoDB as the database.&lt;/p&gt;

&lt;p&gt;After making some projects, contributing to open source repositories, events like Hacktoberfest, participating in Hackathons, I thought of doing something different. Native mobile apps were out of option as I don't use macOS and Android Studio is ought to destroy my laptop for real ! Sorry , jk.&lt;/p&gt;

&lt;p&gt;There were 2 options for me to get started with cross-platform app development.  They were flutter and react native. For flutter, dart language is used. I, being familiar with React chose react native. &lt;/p&gt;

&lt;p&gt;So, I found out from youtube and the official docs that react native is nothing different than react itself. We use react in web with the help of react-dom. In case of react native, we don't use the typical dom element tags like div, p, section, a, etc but we use pre-defined elements which are then converted to native elements for android and ios respectively. This is what happens over the hood.&lt;/p&gt;

&lt;p&gt;To create a project, I used the explo-cli. It was suggested to use expo cli because it helps in a lot of ways : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not much manual configurations required to get started, which helps a beginner to actually get their hands dirty instead of fixing configuration bugs.&lt;/li&gt;
&lt;li&gt;Super fast. Expo makes the react project running in couple of minutes. This saves a lot of time for a beginner, who can focus on things which are more important.&lt;/li&gt;
&lt;li&gt;Now, the fun part. The app can be developed without android studio, xcode on your smartphone only. Expo go app is required to remotely develop the app.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How did I use Expo go ?&lt;/strong&gt;&lt;br&gt;
So, once I had created the project using &lt;code&gt;npx create-react-native-app app-name&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that, I couldn't use expo init, the cli asked the users to migrate to &lt;code&gt;npx create-react-native-app&lt;/code&gt; instead.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then, I moved inside the project dir by using &lt;code&gt;cd my-app&lt;/code&gt;. I used the &lt;code&gt;expo start&lt;/code&gt; command to start the metro builder. The UI for metro server is no longer shown so everything is to be done from the cli. I had installed the Expo go app and scanned the QR code shown in the terminal.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that, ios users need to scan the QR with their camera app.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That was it, my project was running on my smartphone !! Whenever I changed the contents in my VSCode, it was instantly reflected to screen on my smartphone.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There are few things to remember while using the expo go app&lt;br&gt;
The remote device (smartphone) needs to be connected to the same WLAN network with the local setup (computer).&lt;br&gt;
If there is an error, like java socket timeout, using the command &lt;code&gt;expo start --tunnel&lt;/code&gt; would fix it. This might be slower option but it works. This command requires a dependency &lt;code&gt;@expo/ngrok&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I haven't gone through the debugging part yet, so I cannot tell. Apparently errors in code are reflected on the mobile screen, so one can fix it most of the time.&lt;/p&gt;




&lt;p&gt;So, this was my experience. It might have been too long but I tried to keep it simple and to the point. Hope this could help my fellow developers to get started with their react-native journey.&lt;/p&gt;

&lt;p&gt;If you find any problem or want to add something, comment down below so we work on it.&lt;/p&gt;

&lt;p&gt;You can connect with me on :&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/sumanroy369" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Suman373" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/sumanroy369" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Unlocking the Power of HTTP: Navigating the Digital Highway</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Sun, 22 Jan 2023 16:26:14 +0000</pubDate>
      <link>https://dev.to/suman373_30/so-what-is-http--4kb4</link>
      <guid>https://dev.to/suman373_30/so-what-is-http--4kb4</guid>
      <description>&lt;h3&gt;
  
  
  Understand HTTP as a beginner
&lt;/h3&gt;

&lt;p&gt;&lt;br&gt;
&lt;strong&gt;HTTP&lt;/strong&gt; is an acronym for HyperText Transfer Protocol. This protocol is the foundation of the World Wide Web and is used to access data in it. It can be used to transfer the data in the form of plain text, hypertext, audio, video, and so on.&lt;/p&gt;

&lt;p&gt;Let's discuss some of the &lt;strong&gt;features&lt;/strong&gt; of &lt;strong&gt;http&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Connectionless&lt;/strong&gt; -&amp;gt; HTTP is considered to be a connectionless protocol. The whole process starts from the host(client) sending a request to the other host(server) and receiving a response. The connection formed between these 2 for sharing of resources is immediately dropped after the response is received.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Stateless&lt;/strong&gt;-&amp;gt; HTTP is also considered to a stateless protocol. This is because the server gets the information from the client as long as it is connected with it (till server sends the response). In this way, the server does not retain any information about the client.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Media independent&lt;/strong&gt; -&amp;gt; HTTP is also media independent. This means that any type of data can be sent to the server via HTTP protocol as long as the server knows how it can handle the data content. Thus, both the client and the server need to specify the content-type of the data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Client server architecture&lt;/strong&gt; -&amp;gt; This type of model usually involves a client and a server. Here, the server hosts, delivers and manages the resources requested by the client. The client in order to access resources, needs an address which is called URL( Uniform Resource Locator). This URL is consisted of 4 parts and they are : &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Method&lt;/strong&gt; : The method is the protocol used to retrieve the document from the hosted server. For example, &lt;code&gt;http&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Host&lt;/strong&gt; : The host is a computer which is storing the information. Generally computers store web pages. For example, &lt;code&gt;www&lt;/code&gt; (not mandatory field)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port&lt;/strong&gt; : It is the port number of the server. This is also an optional field. It comes between the host and path and it should be separated from the &lt;code&gt;host&lt;/code&gt; by a &lt;code&gt;:&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Path&lt;/strong&gt; : It is the pathname of the file (resource) where the information is stored. It contain &lt;code&gt;/&lt;/code&gt; that separates the directories from the subdirectories and files.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I hope this blog was easy to understand the widely used protocol. If you have any queries, or think there is some error please comment down below ! Keep learning !&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
    <item>
      <title>What is a state controlled form in React js?</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Sun, 15 Jan 2023 14:26:15 +0000</pubDate>
      <link>https://dev.to/suman373_30/controlled-form-in-react-js-2blg</link>
      <guid>https://dev.to/suman373_30/controlled-form-in-react-js-2blg</guid>
      <description>&lt;p&gt;&lt;strong&gt;In this blog we are going to discuss controlled form in React js.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Pre-requisites : You only need to know basics of React and it's hooks. If you don't know, I am sure you can follow along as it is beginner friendly&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, for controlled form inputs, we are going to use&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;useState hook&lt;/li&gt;
&lt;li&gt;onChange event&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is useState?&lt;/strong&gt;&lt;br&gt;
It is a react &lt;strong&gt;hook&lt;/strong&gt; (special functions) that allows you to have state variables in &lt;strong&gt;functional&lt;/strong&gt; components. You pass the initial state to this function and it returns a variable with the current state value and a function for manipulating the state value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is onChange event ?&lt;/strong&gt;&lt;br&gt;
The &lt;strong&gt;onChange&lt;/strong&gt; event in React detects when the value of an input element changes. It is triggered when the element loses focus.&lt;/p&gt;

&lt;p&gt;Now, let's see the code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&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;useState&lt;/span&gt;&lt;span class="p"&gt;}&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&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&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;handleSubmit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&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;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;preventDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
       &lt;span class="c1"&gt;// probably console log it or send to server via api&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"App"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        React form
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt; &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleSubmit&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; 
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt;
        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&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="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Enter name..."&lt;/span&gt;&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;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;Here, we have converted a normal form to a controlled form. It is because we are controlling the form data via states. The initial state is being taken &lt;code&gt;value&lt;/code&gt; attribute, now whenever we change the input field, the &lt;code&gt;onChange&lt;/code&gt; event will be triggered and &lt;strong&gt;setName&lt;/strong&gt; function will be invoked to change the value of &lt;code&gt;name&lt;/code&gt; to the input inside the field &lt;code&gt;e.target.value&lt;/code&gt;. This way, we are letting React handle our form data in the component itself.&lt;/p&gt;




&lt;p&gt;That is the end. If you have any query, drop it in the comment section below. If you think this blog has any error or wrong info, please let me know. &lt;/p&gt;

&lt;p&gt;I hope I could help you understand the topic 😀. If yes, please share it with your friends and others so that this could benefit them too! Till then , keep REACT-ing ❤🚀&lt;/p&gt;

&lt;p&gt;Follow me on: &lt;br&gt;
&lt;a href="https://github.com/Suman373" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/sumanroy369" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/sumanroy369" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>welcome</category>
      <category>community</category>
      <category>forem</category>
      <category>devto</category>
    </item>
    <item>
      <title>Here is why you need to use form tag!</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Mon, 12 Dec 2022 10:25:14 +0000</pubDate>
      <link>https://dev.to/suman373_30/what-are-the-benefits-of-using-form-tag-in-html-1m26</link>
      <guid>https://dev.to/suman373_30/what-are-the-benefits-of-using-form-tag-in-html-1m26</guid>
      <description>&lt;h4&gt;
  
  
  In this short blog we are going to see why wrapping input fields in a form tag is important
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that, the only pre-requisite is HTML. Even if you are not familiar with HTML5, you can follow along. It is simply written.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In &lt;strong&gt;HTML(Hyper text markup language)&lt;/strong&gt; we are familiar with a variety of elements ranging from &lt;code&gt;semantic&lt;/code&gt; (form, section, article, li) to &lt;code&gt;non-semantic&lt;/code&gt; (div, span) elements.&lt;/p&gt;

&lt;p&gt;Often we require to accept &lt;code&gt;data&lt;/code&gt; from users/clients. For example, when registering/signing up to a certain website, we enter our name, email and password.This data is usually entered in the &lt;code&gt;input fields&lt;/code&gt; which are the elements of the &lt;code&gt;form&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Following shows an example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"register"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"form-name"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"form-name"&lt;/span&gt; 
    &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter your name.."&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"form-email"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"form-email"&lt;/span&gt; 
    &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter your email.."&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt; 
   &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"form-password"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"form-password"&lt;/span&gt; 
    &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Enter your password.."&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Note: The action tag in the form element is usually for the script which contains the logic of the backend, i.e., how this data is used in the server.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now let's jump into the importance of it.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Once the data is filled up in their respective fields, it has to be submitted. When the user clicks on the submit button with attribute &lt;code&gt;type&lt;/code&gt;="submit", the form will have an attribute &lt;code&gt;action&lt;/code&gt;, which will get triggered automatically. Now, this reduces our work as we had to listen to the click event with javascript event listeners and deal with the data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Often we have to make sure the user has filled in details before clicking submit. This is done by &lt;b&gt;form validation&lt;/b&gt; using javascript. Now, if we wrap our &lt;code&gt;input&lt;/code&gt; in &lt;code&gt;form&lt;/code&gt;, we can use a &lt;code&gt;boolean attribute&lt;/code&gt; known as &lt;b&gt;&lt;code&gt;required&lt;/code&gt;&lt;/b&gt; in the &lt;strong&gt;input&lt;/strong&gt; tag. This will make sure, that all the &lt;b&gt;required input fields&lt;/b&gt; are filled before submitting without writing extra code.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the picture below, you can see how it looks like &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%2F00e9ax2950zc5njhi2ap.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%2F00e9ax2950zc5njhi2ap.png" alt="Required attribute in html5" width="503" height="177"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.A form is a &lt;code&gt;semantic&lt;/code&gt; tag, a tag which conveys a meaning to both the browser and the developer. Using semantic tags helps assistive devices like &lt;code&gt;screen readers&lt;/code&gt;, &lt;code&gt;bots&lt;/code&gt;, &lt;code&gt;web-crawlers&lt;/code&gt; better understand the content of the page in the website or web application and help in &lt;strong&gt;SEO&lt;/strong&gt; and ranking of the site.&lt;/p&gt;




&lt;p&gt;That is the end. I would personally suggest you to use form tag for forms. I hope I could bring clarity on the &lt;strong&gt;why&lt;/strong&gt; of the topic. If you liked it, share it. Also, if you think there is something wrong or you have any questions, please drop a comment down below so that we can fix it.&lt;/p&gt;

&lt;p&gt;Till then, keep developing ! 💙&lt;/p&gt;

&lt;p&gt;Follow me on:&lt;br&gt;
&lt;a href="https://linkedin.com/in/sumanroy369" rel="noopener noreferrer"&gt;Linkedin&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Suman373" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/sumanroy369" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Deploy your static React app under 5mins</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Sun, 06 Nov 2022 15:16:55 +0000</pubDate>
      <link>https://dev.to/suman373_30/deploy-your-static-react-app-under-5mins-4oij</link>
      <guid>https://dev.to/suman373_30/deploy-your-static-react-app-under-5mins-4oij</guid>
      <description>&lt;p&gt;&lt;strong&gt;We all have been to the stage where we had completed our first react app but didn't know how to showcase it publicly.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;So, in this blog, I am going to show you how to host your react app for free.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pre-requisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make sure you have completed building a react app.&lt;/li&gt;
&lt;li&gt;Have npm installed locally or globally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;&lt;br&gt;
Once you are done with your react app, you need to create the build folder which will contain the index, stylesheets, icons, assets and manfiest files. This folder is responsible for serving your static content when deployed.&lt;br&gt;
Use this command in the root dir of your app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;&lt;br&gt;
There are so many platforms to host your static site like Netlify, Vercel, Github Pages, Cloudflare Pages, Forge, etc. We are going to use Netlify&lt;br&gt;
So, you need to create an account on Netlify and log in.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;&lt;br&gt;
Click on the &lt;code&gt;add new site&lt;/code&gt; button.&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%2Flujs6ogkijfdg2obtjp4.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%2Flujs6ogkijfdg2obtjp4.png" alt="Add new button" width="212" height="78"&gt;&lt;/a&gt;&lt;br&gt;
Then, click on the &lt;code&gt;deploy manually&lt;/code&gt; button to deploy your build folder directly.&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%2Fbnrlka4j115u70u5jix7.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%2Fbnrlka4j115u70u5jix7.png" alt="Deploy manually button" width="390" height="210"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;&lt;br&gt;
Now, we have 2 options to deploy it. We can do it either by browsing our local files or dragging and dropping.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Click on the browse files to upload the folder from your local machine.
&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%2Flw78jt25hhqjd4ntaide.png" alt="Browse files" width="373" height="327"&gt;
&lt;/li&gt;
&lt;li&gt;Drag the folder from your local and drop it in the middle.&lt;/li&gt;
&lt;/ol&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%2Falbb44bs7dcedkmuqq58.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%2Falbb44bs7dcedkmuqq58.png" alt="Drag and drop folder" width="423" height="342"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt;&lt;br&gt;
Now, Netlify will publish your site and host it for free. You will be provided a random url but you can change it to your preferance.&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%2Fwo34o1k532jqvav17hmu.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%2Fwo34o1k532jqvav17hmu.png" alt="Site published" width="730" height="275"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: The url for your site should be unique and will always end with &lt;code&gt;netlify.app&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Congratulations! ✨ You have hosted your react app successfully and now you can showoff your project to your friends, family and literally anyone on this planet 😉&lt;/p&gt;

&lt;p&gt;If you have any query, drop it in the comment section below. If you think this blog has any error or wrong info, please let me know. &lt;/p&gt;

&lt;p&gt;I hope I could help you somehow 😀. If yes, please share it with your friends and others so that this could benefit them too! Till then , keep REACT-ing ❤🚀&lt;/p&gt;

&lt;p&gt;Follow me on: &lt;br&gt;
&lt;a href="https://github.com/Suman373" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/sumanroy369" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>netlify</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Fetch vs Axios in Javascript</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Tue, 11 Oct 2022 15:22:08 +0000</pubDate>
      <link>https://dev.to/suman373_30/fetch-vs-axios-in-javascript-4oj0</link>
      <guid>https://dev.to/suman373_30/fetch-vs-axios-in-javascript-4oj0</guid>
      <description>&lt;h2&gt;
  
  
  Hello there ! 👋 In this blog, we are going to learn how to implement APIs by using Fetch API and Axios
&lt;/h2&gt;

&lt;p&gt;Before we get started, the only pre-requisite needed for this tutorial is basic understanding of javascript.&lt;/p&gt;

&lt;p&gt;Table of contents&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What is fetch?&lt;/li&gt;
&lt;li&gt;Syntax of fetch&lt;/li&gt;
&lt;li&gt;What is axios?&lt;/li&gt;
&lt;li&gt;Syntax for axios&lt;/li&gt;
&lt;li&gt;Key differences b/w fetch and axios&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;span id="fetch"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Fetch ?
&lt;/h3&gt;

&lt;p&gt;Fetch is a standard way of sending asynchronous api calls to the server in web applications. It is a feature of ECMASCRIPT6(ES6) and was introduced back in 2015.&lt;br&gt;
The Fetch API provides a method called &lt;strong&gt;fetch&lt;/strong&gt; () which is defined on the window object. It needs an argument which is the &lt;strong&gt;url&lt;/strong&gt; of the endpoint (resource). This method returns a  &lt;strong&gt;promise&lt;/strong&gt; which is resolved to retrieve the response.&lt;/p&gt;

&lt;p&gt;&lt;span id="fetch-syntax"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Let us see an example, where we are fetching some data from an endpoint&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="nx"&gt;fetchNames&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;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://localhost:5000/api/names/&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;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="c1"&gt;// successful req, change to json&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;data&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// data contains the json object&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
     &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&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;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// something went wrong&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;blockquote&gt;
&lt;p&gt;Note that, for &lt;strong&gt;Post&lt;/strong&gt; request we also need to include the   &lt;strong&gt;options&lt;/strong&gt;&lt;br&gt;
For example, we are sending a name with id to the server&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&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="nx"&gt;sendName&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;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;http://localhost:5000/api/user/&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;span class="c1"&gt;// the method type &lt;/span&gt;
       &lt;span class="na"&gt;method&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
       &lt;span class="c1"&gt;// contents to send i.e., the body&lt;/span&gt;
       &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="na"&gt;name&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;David&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
       &lt;span class="p"&gt;}),&lt;/span&gt;
       &lt;span class="c1"&gt;// headers of the request&lt;/span&gt;
       &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:{&lt;/span&gt;
        &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Application/json&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;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&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;So, we know how fetch works. Now, let us see axios.&lt;/p&gt;

&lt;p&gt;&lt;span id="axios"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Axios?
&lt;/h3&gt;

&lt;p&gt;Axios is a &lt;strong&gt;javascript library&lt;/strong&gt; used to make &lt;strong&gt;HTTP&lt;/strong&gt; requests from node js(runtime for javascript) or XMLHttpRequests (XHR) from the browser. This too supports the promise api that is native to ES6.&lt;/p&gt;

&lt;p&gt;&lt;span id="axios-syntax"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Example for showing how we can fetch data and post data using axios&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="c1"&gt;// get request&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fetchNames&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&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;// we are using asynchronous function so we need to await for &lt;/span&gt;
   &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;be&lt;/span&gt; &lt;span class="nx"&gt;processed&lt;/span&gt;
   &lt;span class="k"&gt;try&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; 
     &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:5000/api/names/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
     &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&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="c1"&gt;// post request&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;postName&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&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;// same as previous&lt;/span&gt;
   &lt;span class="k"&gt;try&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;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; 
       &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http://localhost:5000/api/users/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,{&lt;/span&gt;
          &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;David&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;
     &lt;span class="p"&gt;});&lt;/span&gt;
     &lt;span class="c1"&gt;// log the data from the response &lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
     &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// something went wrong!&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;span id="diff"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Key differences between fetch and axios
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Fetch&lt;/th&gt;
&lt;th&gt;Axios&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Fetch is built-in for most modern web browsers, so no installation is required&lt;/td&gt;
&lt;td&gt;Axios is a stand-alone third party package (library) which requires installation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fetch has no url in the request object&lt;/td&gt;
&lt;td&gt;Axios has url in it's request object&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;It doesn't have XSRF (cross-site request forgery) protection&lt;/td&gt;
&lt;td&gt;It has XSRF protection in-built&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Request is made then the response is converted to json&lt;/td&gt;
&lt;td&gt;Here, the response is automatically transformed to json&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Request has body which is converted to string&lt;/td&gt;
&lt;td&gt;Request has data which contains the object itself&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Abort requests by using Abort controller web api&lt;/td&gt;
&lt;td&gt;Has request-timeouts for cancelling requests or use AbortController&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;Hopefully, I have been able to clear the methods of making api calls to the server. If you have understood, then like the post, comment and share so that others can benefit from this.&lt;br&gt;
Thank you for reading this far! Keep developing ! ❤❤&lt;/p&gt;

</description>
      <category>api</category>
      <category>fetch</category>
      <category>axios</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Stack Using SLL for beginners</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Sun, 02 Oct 2022 07:55:56 +0000</pubDate>
      <link>https://dev.to/suman373_30/stack-using-sll-for-beginners-400g</link>
      <guid>https://dev.to/suman373_30/stack-using-sll-for-beginners-400g</guid>
      <description>&lt;p&gt;&lt;strong&gt;Let us write the code for implementing stack using linkedlist&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;Pre-requisites&lt;/em&gt; : brief knowledge of linkedlist operations.&lt;br&gt;
Before we get started let us know what is Stack? &lt;br&gt;
A stack is a data structure which follows the LIFO principle. It is abbreviation for Last-In-First-Out. Technically, the last item that is inserted into the data structure can be taken out first.&lt;br&gt;
Applications for stack can be seen in real life, such as a stack of books, files, the cylindrical container for ping pong balls, the biscuit wrapper,etc.&lt;/p&gt;

&lt;p&gt;The operations that can be performed on Stack data structure are push(insertion), pop(deletion) and peek(top element).&lt;/p&gt;

&lt;p&gt;The code : &lt;br&gt;
1.&lt;strong&gt;Defining the structure for our nodes&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

struct Node{
    int data;
    struct Node* next;
};
// global top pointer
struct Node* top=NULL;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.&lt;strong&gt;Writing print function for printing the elements&lt;/strong&gt;&lt;br&gt;
We traverse through the list from top until we reach null and print all the data for the nodes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void print(){
    struct Node *traverse = top;
    while(traverse!=NULL){
        printf("%d ",traverse-&amp;gt;data);
        traverse = traverse-&amp;gt;next; // iterate
    }
    printf("\n");
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.&lt;strong&gt;Addition(push) of new element(node) to our stack(list)&lt;/strong&gt;&lt;br&gt;
Pushing new element to stack is same as insertion of node in the beginning of the list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void Push(int x){
    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));
    newNode-&amp;gt;data = x;
    newNode-&amp;gt;next = NULL;
    if(top==NULL){
        top = newNode;
        print();
        return;
    }
    // link fix with first node
    newNode-&amp;gt;next = top;
    top = newNode;
    printf("Stack after insertion : \n");
    print();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.&lt;strong&gt;Deletion(popping) element(node)from the stack(list)&lt;/strong&gt;&lt;br&gt;
Popping from stack is same as deleting node from the beginning of the list.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void Pop(){
    if(top == NULL){
        printf("Stack is empty!!\n");
        return ;
    }
    struct Node *temp = top-&amp;gt;next;  // one node skipped i.e., deleted
    top-&amp;gt;next = NULL;
    top = temp;
    printf("Stack after deletion: \n");
    print();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;5.&lt;strong&gt;Peek(show top) element(node)&lt;/strong&gt;&lt;br&gt;
Peeking is showing the top element of the array if it exists else the stack is empty&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;void peek(){
    if(top == NULL) printf("Stack empty!\n");
    else printf("Top element is: ",top-&amp;gt;data);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;6.&lt;strong&gt;Now we write the main function and interface for the user interaction using switch case&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int main(){
    top = NULL;
    int choice;
    printf("Enter 1 for push, 2 for pop, 3 for peek: ");
    scanf("%d",&amp;amp;choice);
    // switch statement
    switch(choice){
        case 1:
            int value;
            printf("Enter the value for insertion : ");
            scanf("%d",&amp;amp;value);
            Push(value);
            break;
        case 2:
            Pop();
            break;
        case 3:
            peek();
            break;
        default: 
                printf("Wrong choice!");
                break;

    }
    return 1;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, run the program in your editor and make sure to try out different values of insertion and deletion to make sure the edge cases are being followed. If you find any bug, comment down below!&lt;br&gt;
Thank you 👋&lt;/p&gt;

</description>
      <category>stack</category>
      <category>dsa</category>
      <category>beginners</category>
      <category>c</category>
    </item>
    <item>
      <title>A Simple Card hover animation for beginners</title>
      <dc:creator>Suman Roy</dc:creator>
      <pubDate>Fri, 12 Aug 2022 16:48:17 +0000</pubDate>
      <link>https://dev.to/suman373_30/a-simple-card-hover-animation-for-beginners-5322</link>
      <guid>https://dev.to/suman373_30/a-simple-card-hover-animation-for-beginners-5322</guid>
      <description>&lt;p&gt;&lt;strong&gt;We will be looking at a very simple card hover animation made using html and css only. If you are aware of css properties, you will understand this but if you are a total beginner I would r&lt;/strong&gt;&lt;strong&gt;ecommend to learn the basics of CSS.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt; : Writing our markup i.e., HTML &lt;/p&gt;

&lt;p&gt;We need a parent wrapper and a child which contains some text content. It can be anything of your choice as long as it looks good.&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;body&amp;gt;
   &amp;lt;div class="parent"&amp;gt;
     &amp;lt;div class="child-text"&amp;gt;
       Hi there! Howdy? I am fine. Fun fact? I use vanilla css for most of my projects because I love it!! 
   &amp;lt;/div&amp;gt;
 &amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt; : We will add the basic resets and stylings to our body. Note that the code has been written in codepen so, there are no meta tags for the markup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* resets */
*,{
  margin:0;
  padding:0;
  box-sizing:border-box;
}
/* styles for the body */
body{
  height:100vh;
  width:100vw;
  overflow:hidden;
  display:grid;
  place-content:center;
  background:#000000;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The body is displayed as grid, with its contents center. You can also use transform property or flexbox to center the wrapper div.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Watch carefully how we design the parent div, which contains the child div. It has a random background image, you can use any image or color or gradient background of your choice.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The position is** relative**, it is very important, we will get to know!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Overflow **is **hidden&lt;/strong&gt;. We hide our overflow as the child div will be moved in Y axis , towards the bottom.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.parent {
  height:20rem;
  width:20rem;
  overflow:hidden;
 position:relative; 
  border-radius:10px;
  background:url('https://media.istockphoto.com/photos/clouds-on-sky-picture-id184103864?k=20&amp;amp;m=184103864&amp;amp;s=612x612&amp;amp;w=0&amp;amp;h=m1yaRvpLy-e76e6ZbX2QkCbsGFhubVaaDntDOpL2zYE=') no-repeat center/cover;
  cursor:pointer;
  text-align:center;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;*&lt;em&gt;Step 4 *&lt;/em&gt;: We will use a black overlay. This is because we want the text in the child div(transparent background) to have contrast with the overlay.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For this we are using before pseudo class. This is going to have position as absolute and would have a background of black ( with very low opacity).
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.parent::before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  height:100%;
  width:100%;
  z-index:-1;
  background:rgb(0,0,0,0.4);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5&lt;/strong&gt; : Now, we style our child div, which is the hero for this card animation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This div can be styled anyhow, the only thing to remember is to have a **transform property **on it. It transforms this div in any direction explicitely. Here we have transformed it in -Y axis by 15rem.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* the child container with the text */
.child-text{
  margin-top:4rem;
  font-size:1.5rem;
  color:white;
  text-shadow:1px 0 1px black;
  padding:1rem;
  transition:transform 500ms ;
  transform:translateY(15rem);
  cursor:pointer;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6&lt;/strong&gt;: We are almost done! All we have now is to position the child div correctly on hover over the parent div. &lt;br&gt;
When the parent is hovered, the child will have its transform property of translate in y axis to 0. This makes the child pop up. &lt;strong&gt;To slow the effect down, we have used transition of 500ms&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.parent:hover .child-text{
  transform:translateY(0rem);
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7&lt;/strong&gt; : Before we are ready with the card, lets add some coolness to our parent div. We have added drop shadow and box shadow, you can also use borders, or new background color.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.parent:hover{
  border-radius:10px;
  box-shadow:0 0 10px white;
  filter:drop-shadow(0 1px 2px black);
  transform:scale(0.98);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 8&lt;/strong&gt;: We have finished our card. Wow, that was a lot wasn't it? 😅 The only way to become good at it, is by practising. Try experimenting with this code and you will be amazed how you can make some sleek animations with little bit of change here and there! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I hope I could teach you something new and useful. If you are reading this, make sure to share it with your friends who are new to CSS and needs help with their beautiful projects. Happy CSS'ing!! ❤&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>css3</category>
      <category>card</category>
      <category>webdesign</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
