<?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: Garv Nanwani</title>
    <description>The latest articles on DEV Community by Garv Nanwani (@garvnanwani).</description>
    <link>https://dev.to/garvnanwani</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%2F416805%2F6f9f3bf6-3781-4af9-a343-ffc14fd22a08.jpg</url>
      <title>DEV Community: Garv Nanwani</title>
      <link>https://dev.to/garvnanwani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/garvnanwani"/>
    <language>en</language>
    <item>
      <title>Introduction To Testing In React</title>
      <dc:creator>Garv Nanwani</dc:creator>
      <pubDate>Wed, 07 Oct 2020 17:23:02 +0000</pubDate>
      <link>https://dev.to/dailydotdev/introduction-to-testing-in-react-4958</link>
      <guid>https://dev.to/dailydotdev/introduction-to-testing-in-react-4958</guid>
      <description>&lt;p&gt;Consider a situation, You build out an entire application, and now you want to release it on the web so that other people can use it. But you are scared that your application may fail in some conditions, and your users may start complaining.&lt;br&gt;&lt;br&gt;
Some Bugs may reproduce, or some end cases may cause your application to fail. It might not affect you as a beginner, but in large-scale production applications, you can't only take the risk of your app failing when it goes live.&lt;br&gt;
So how do you make sure this never happens to you...&lt;br&gt;
The answer is Testing.&lt;/p&gt;
&lt;h2&gt;
  
  
  So what exactly is testing?
&lt;/h2&gt;

&lt;p&gt;Testing is a line-by-line review of how your code is going to execute. You write some piece of code that executes the script you have written for your app and makes sure &lt;strong&gt;the results match the desired output in ideal condition.&lt;/strong&gt; &lt;br&gt;
Testing comes in handy when you make some updates to your code or when you contribute to open source, for example. After updating a piece of code, you can run a test to ensure that the update does not break functionality already in the application.&lt;br&gt;
In specific, you test for end cases or boundary conditions that may or may not occur when a real-world user it.&lt;br&gt;
How your application behaves when the user enters some invalid data; Or is there any security issue and things like that.&lt;br&gt;
You can say that testing is an integral part of any development process. You just can't ignore it. &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%2Fi%2F9p6ypsk7dlxvzcrkr33s.jpeg" 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%2Fi%2F9p6ypsk7dlxvzcrkr33s.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I know it can be tedious sometimes to write a piece of code that checks whether your previous written code works appropriately or not, but I guarantee once you get the hold of it, you will love the concept of testing.&lt;/p&gt;
&lt;h2&gt;
  
  
  Testing helps you:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Save the time of manually checking each part of the application. Just write some piece of code and automate the process.&lt;/li&gt;
&lt;li&gt;Make sure a bug doesn't reproduce itself. Whenever you fix a bug, you can write some test cases so that it never repeats itself.&lt;/li&gt;
&lt;li&gt;Improve the flexibility of your code and makes it more maintainable otherwise, you would manually have to find the survey the whole code-base just to fix a small bug
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And a lot more...&lt;/p&gt;

&lt;p&gt;Lets quickly go over the types of testing: &lt;/p&gt;
&lt;h3&gt;
  
  
  1. Unit tests
&lt;/h3&gt;

&lt;p&gt;Unit testing refers to testing individual pieces of your code or, as the name suggests, unit parts of your code to make sure the pieces fit together perfectly. &lt;br&gt;
Talking specifically about React, unit tests typically do not require a browser. You test the rendering output. Like what happens when a state changs or a given set of input changes, and do the changes affect the DOM or not.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Functional testing
&lt;/h3&gt;

&lt;p&gt;Functional testing is more focused on testing the behavior of our component. &lt;br&gt;
For example, whether or not the component renders properly or not as an individual, the onClick function on a component works fine or not, or the Navbar shows the name of the logged-in person correctly.&lt;br&gt;&lt;br&gt;
Functional tests usually run in isolation (i.e., testing the component functionality without the rest of the application).&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Integration testing
&lt;/h3&gt;

&lt;p&gt;Integration testing tests the entire service of our application and attempts to replicate the experience an end-user would experience when using our application.&lt;br&gt;
Integration testing is generally slower than the unit and functional testing, as it is quite hard to match a user experience.&lt;/p&gt;

&lt;p&gt;There are many other terminologies that you may encounter like a smoke test and shallow rendering but let's keep things simple for this.&lt;/p&gt;
&lt;h2&gt;
  
  
  Introduction to Jest and Enzyme
&lt;/h2&gt;

&lt;p&gt;Jest is a node-based test runner used for fast parallel running of tests in a node environment. It is one of the most used frameworks for testing purposes. &lt;br&gt;
Jest focuses a lot on simplicity. It can be installed with npm or Yarn. It works excellent for React as well as other applications.&lt;/p&gt;

&lt;p&gt;After installing it, What you do is you write some tests and then run the command npm test in a terminal window within your app directory. It will initialize Jest and start testing in watch mode, which will then automatically run tests whenever you make changes to associated files.&lt;/p&gt;

&lt;p&gt;Enzyme is a library that is used to test React applications. It's designed to test components, and it makes it possible to write assertions that simulate actions that confirm whether the UI is working correctly.&lt;br&gt;
Jest and Enzyme complement each other so well, so in this article, we will be using both.&lt;/p&gt;

&lt;p&gt;There are other testing frameworks also such as Mocha, which you can give a try. &lt;br&gt;
But for the moment, let's get started with setting up Jest.&lt;/p&gt;
&lt;h3&gt;
  
  
  Setting up jest
&lt;/h3&gt;

&lt;p&gt;If you use Create React App for setting up any new react app, then you don't need to install it because it comes with Jest preinstalled.&lt;br&gt;
If you want to install Jest manually, just type&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev jest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in the terminal. And in the package.json file, set up the command for running tests.&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="p"&gt;...&lt;/span&gt;
&lt;span class="nx"&gt;scripts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;test&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="s2"&gt;jest&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Writing your first test with Jest
&lt;/h3&gt;

&lt;p&gt;Okay, now, all you need to do is create a file where you will write the tests.&lt;br&gt;
But how does Jest know what is a test file? &lt;br&gt;
There are generally two ways you tell Jest that this is a test file.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If any files in your directory have the name &lt;strong&gt;test&lt;/strong&gt;, it's considered a test. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If your file has suffix .spec.js or .test.js, it is marked as a test file.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, Jest scans through your directory looking for such files and runs the code inside them that's your tests. &lt;/p&gt;

&lt;p&gt;Let's see some code in action, &lt;/p&gt;

&lt;p&gt;Make a file called Home.test.js and all the following code to it&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="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Our first test&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Multiplies numbers&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1000&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;Let's understand this piece of code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;describe() is used to wrap up tests that are of a similar type, and you can describe what you are testing for or what this is the purpose of these groups of tests.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;it() is used to define a single test. It describes what you are trying to achieve with that particular test or what the function does. You can also use the test() method in place of it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;expect() and .toEqual() is where we actually perform the test. We put the function inside expect(), which gets the actual result of the function, and the expected result goes in toEqual(). If both match, the tests pass, or else they fail.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run the following piece of code with node test command. You will notice a beautiful table like the layout on the console, which gives you a lot of information related to the tests. For example: whether it passed or failed, failed at which line, the amount of time it took, and many other things as well.&lt;/p&gt;

&lt;p&gt;For now, let's focus on PASS and FAIL. The above code is no doubt correct. but what if we pass something like this,&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="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Our second test&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Multiplies numbers&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;toEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;25&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;This will result in a failed test, and you will see the word FAIL flashing in the console.&lt;/p&gt;

&lt;p&gt;Hurray, You wrote your first test.&lt;/p&gt;

&lt;p&gt;Of course, real-world tests won't be this simple, but this will surely give you a general overview of what testing actually looks like and a brief introduction of Jest as well.&lt;/p&gt;

&lt;p&gt;Jest is a very friendly framework. It tells you exactly where your tests failed and gave you inner insights as well.&lt;/p&gt;

&lt;p&gt;Now, you can play around with Jest and start testing your javascript code.&lt;/p&gt;

&lt;p&gt;If you want to try testing out React Component, then there is this Enzyme framework, making testing react components a lot easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing React Components using Enzyme
&lt;/h3&gt;

&lt;p&gt;Enzyme doesn't come preinstalled with create-react-app, so you will have to install it using the command manually.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev enzyme enzyme-adapter-react-16 react-test-renderer
//or with yarn
yarn add --dev enzyme enzyme-adapter-react-16 react-test-renderer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note- Installation of enzyme depends on the version of React you are using, here we will be using react-16&lt;/p&gt;

&lt;p&gt;To use Enzyme, we have to configure the package that we just installed to use react, so make a file named setupTests.js in the src folder and add the following code. &lt;br&gt;
It uses the adapter we just installed with the enzyme package.&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;// src/setupTests.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;configure&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;enzyme&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;Adapter&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;enzyme-adapter-react-16&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;adapter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Adapter&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;We can now use Enzyme for our tests. &lt;/p&gt;

&lt;p&gt;Create a file with the name of the component you want to test and add .test.js after it. &lt;br&gt;
Please write down the following code in it.&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;// MyComponent.test.js&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&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;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;shallow&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;enzyme&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;MyComponent&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;./MyComponent&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;describe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;MyComponent Render Test&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;should render my component properly&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="o"&gt;=&amp;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;wrapper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;shallow&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;MyComponent&lt;/span&gt; &lt;span class="o"&gt;/&amp;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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once again, describe is used to describe the purpose of a group of tests, and the it() function specifies what a particular test is defined for.&lt;/p&gt;

&lt;p&gt;The shallow() assertion method is a part of enzyme, shallow() is used to test the component it is provided, whether it renders properly or not. One thing to note here is that it ignores any child components that may be present in the component, so it is a type of unit test which tests a particular piece of code.&lt;br&gt;
If you want to test out the children as well, use the mount() function instead, which performs an integration test on the entire component and its children.&lt;/p&gt;

&lt;p&gt;This is the simplest example of testing a component using enzyme. The journey doesn't end here. You will probably need to know much other stuff before you start writing tests for real-world applications, but that was a good start.&lt;/p&gt;

&lt;p&gt;If you want to learn more about testing and, in particular, testing in react, then do check out the documentation of Jest and React. You will find a lot of useful stuff there.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://jestjs.io/docs/en/tutorial-react" rel="noopener noreferrer"&gt;Jest docs for react testing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/testing.html" rel="noopener noreferrer"&gt;react docs testing overview&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And Remember: &lt;/p&gt;

&lt;p&gt;"Tests can't fail if there aren't any tests in the first place." &lt;/p&gt;

&lt;p&gt;Don't go by this principle. 😂&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a href="https://api.daily.dev/get?r=devto" rel="noopener noreferrer"&gt;Daily&lt;/a&gt; delivers the best programming news every new tab. We will rank hundreds of qualified sources for you so that you can hack the future.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://api.daily.dev/get?r=devto" rel="noopener noreferrer"&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%2Fi%2Fb996k4sm4efhietrzups.png" alt="Daily Poster"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>testing</category>
      <category>tdd</category>
    </item>
    <item>
      <title>Making An Awesome Developer Portfolio</title>
      <dc:creator>Garv Nanwani</dc:creator>
      <pubDate>Mon, 21 Sep 2020 10:36:41 +0000</pubDate>
      <link>https://dev.to/dailydotdev/making-an-awesome-developer-portfolio-ek0</link>
      <guid>https://dev.to/dailydotdev/making-an-awesome-developer-portfolio-ek0</guid>
      <description>&lt;p&gt;Recently, I posted about my portfolio on twitter and got a fantastic response to that.&lt;/p&gt;


&lt;blockquote&gt;
&lt;p&gt;Just completed my portfolio website, made it just with Html and CSS. Give it a look.&lt;br&gt;Any suggestions are welcome 🤗🤭&lt;a href="https://t.co/cuCbRJcNo3" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;a href="https://t.co/cuCbRJcNo3" rel="noopener noreferrer"&gt;https://t.co/cuCbRJcNo3&lt;/a&gt;&lt;a href="https://twitter.com/hashtag/100DaysOfCode?src=hash&amp;amp;ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;#100DaysOfCode&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/DEVCommunity?src=hash&amp;amp;ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;#DEVCommunity&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/CodeNewbie?src=hash&amp;amp;ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;#CodeNewbie&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/programming?src=hash&amp;amp;ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;#programming&lt;/a&gt; &lt;a href="https://twitter.com/hashtag/javascript?src=hash&amp;amp;ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;#javascript&lt;/a&gt; &lt;a href="https://t.co/j03iTm2RBz" rel="noopener noreferrer"&gt;pic.twitter.com/j03iTm2RBz&lt;/a&gt;&lt;/p&gt;— Garv Nanwani (@thisisgarv) &lt;a href="https://twitter.com/thisisgarv/status/1306458518107586562?ref_src=twsrc%5Etfw" rel="noopener noreferrer"&gt;September 17, 2020&lt;/a&gt;
&lt;/blockquote&gt;  

&lt;p&gt;I received many messages from you guys asking how to build a portfolio and what things to focus on.  &lt;/p&gt;

&lt;p&gt;So I decided to write an article giving some of my best tips on building a developer portfolio for yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  First of all, why you should have a developer portfolio?
&lt;/h2&gt;

&lt;p&gt;The two main things that can help you get that job are the necessary skills, projects, and a place to showcase them.&lt;br&gt;
That's where you need a killer portfolio.  &lt;/p&gt;

&lt;p&gt;A portfolio not only shows your works or what you know, but it represents your journey. You can have a great twitter profile or a good number of GitHub repositories. Still, when an employer needs to see your work collected in a single place, he won't go through your entire profile, spending hours studying you and finding your best repositories to get to know you. Having a developer portfolio gives him an excellent little summary of your journey, and he can judge that.&lt;/p&gt;

&lt;p&gt;Enough talk, now lets jump straight to the things you should and should not do to make your portfolio stand out:&lt;/p&gt;

&lt;h2&gt;
  
  
  1) Have a primary focus
&lt;/h2&gt;

&lt;p&gt;First, Clear why you want to make a developer portfolio.&lt;br&gt;
It can be to get a job or to show off your skills.&lt;br&gt;
Depending on your focus, try to write the things that are relevant to the job needs or the things you want people to know about you.&lt;/p&gt;

&lt;p&gt;Don't add everything you have tried in your life; for example, just add MERN stack to get a MERN job. Don't be like I have done some angular, some Vue, and all that. Be specific and confident in the things you mention.&lt;/p&gt;

&lt;h2&gt;
  
  
  2) A Clean UI
&lt;/h2&gt;

&lt;p&gt;The design and overall look of your site are the first things that anyone sees in your portfolio. It may seem obvious at first, but most people don't take their portfolio seriously. They think a portfolio is just a place to show your skills, but no, your portfolio itself is your biggest work.&lt;/p&gt;

&lt;p&gt;So, do spend some time planning out what to include in your portfolio and what to not; the color scheme, layout, responsiveness, everything combined lead to an outstanding developer portfolio.&lt;/p&gt;

&lt;h2&gt;
  
  
  3) Put a smiling photo of yours in the portfolio
&lt;/h2&gt;

&lt;p&gt;Your portfolio should have a photo of yours, no matter what. It's one of the essential tips and has a massive impact on the person seeing your portfolio. It should be a smiling photo of you, no matter how you look.&lt;/p&gt;

&lt;p&gt;Don't try to put a smiling photo working on a laptop or something like your side profile. Try to be real. A genuine smile makes a difference, be proud of you and your smile. It will help you build trust, and people will feel comfortable connecting with you.&lt;/p&gt;

&lt;h2&gt;
  
  
  4) Your portfolio should tell a story
&lt;/h2&gt;

&lt;p&gt;What every human being understands are emotions and stories. When your portfolio conveys your story, people will be able to see your struggle and will appreciate your work. It can be a timeline or the journey behind the projects you made, the problems you faced, what you learned, etc.&lt;/p&gt;

&lt;p&gt;Now, Don't write long essays that people find hard to read. Mention everything in points, and bring attention to the crucial parts.&lt;/p&gt;

&lt;h2&gt;
  
  
  5) Put high-quality projects on your portfolio
&lt;/h2&gt;

&lt;p&gt;Let them be two or three only, but they should represent your experience. Three high-quality projects are enough to get you that edge from others, don't just put a picture and link. Add a story to that like tell:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how you felt before going to that project&lt;/li&gt;
&lt;li&gt;what you learned out of it &lt;/li&gt;
&lt;li&gt;what was its benefit, your skill level before and after&lt;/li&gt;
&lt;li&gt;what problems you faced&lt;/li&gt;
&lt;li&gt;What steps did you take to get to that point&lt;/li&gt;
&lt;li&gt;screenshot of some code sample in that project that you liked&lt;/li&gt;
&lt;li&gt;how that part of code made you learn something new&lt;/li&gt;
&lt;li&gt;how you made that better 
Again, be real and tell your journey through it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  6) Creativity shines through boundaries
&lt;/h2&gt;

&lt;p&gt;Do not be creative, and by that, I mean to have something different, but don't overdo things or try to act cool.&lt;br&gt;
Research portfolios of top developers and learn from them. Learn how they mention so many things in such a lovely little short format and get impressed by their simplicity.&lt;br&gt;
Don't get too many animations or other hi-fi stuff on the site. Not only will they decrease the website's performance, but most people find these too fancy, and it gets irritating sometimes.&lt;/p&gt;

&lt;h2&gt;
  
  
  7) Lastly, be yourself
&lt;/h2&gt;

&lt;p&gt;By that, I mean, don't try to act smart or put some cheesing lines. Just use your own words. Your language will help you connect better. Don't use cursing or BS words ;). Please keep it clean, keep it relevant, and there you go. Remember, nobody can write your story better than you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some extra tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Don't put a form on your website. Nobody fills it. Just place an email icon and make it big enough for people to see and reach you.&lt;/li&gt;
&lt;li&gt;Avoid using percentage bars in your skills section. Just write proficient in and comfortable with, and that's it. Percentages can be relative, and you really can't judge how good you are unless you have real-world experience.&lt;/li&gt;
&lt;li&gt;Have a well-maintained Linkedin and twitter profile and keep all the social links updated on the website so that people find it easy to reach out to you.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you want to check out my portfolio, here's a link to that-&lt;br&gt;
&lt;a href="https://garvnanwani.netlify.app" rel="noopener noreferrer"&gt;My Portfolio Garv Nanwani&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;It's still a work in progress, but I will be happy to know your thoughts and suggestions. &lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a href="https://api.daily.dev/get?r=devto" rel="noopener noreferrer"&gt;daily.dev&lt;/a&gt; delivers the best programming news every new tab. We will rank hundreds of qualified sources for you so that you can hack the future.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://api.daily.dev/get?r=devto" rel="noopener noreferrer"&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%2Fi%2Fb996k4sm4efhietrzups.png" alt="Daily Poster"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>design</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Submission for the actions hackathon</title>
      <dc:creator>Garv Nanwani</dc:creator>
      <pubDate>Thu, 17 Sep 2020 07:17:22 +0000</pubDate>
      <link>https://dev.to/garvnanwani/submission-for-the-actions-hackathon-2h69</link>
      <guid>https://dev.to/garvnanwani/submission-for-the-actions-hackathon-2h69</guid>
      <description>&lt;p&gt;This is the post for the submission of my action for the &lt;a href="https://dev.to/peter279k/getting-started-with-github-action-to-deploy-website-continuously-2gn0"&gt;actionshackathon&lt;/a&gt; on DEV.&lt;/p&gt;

&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;The GitHub Actions for pushing to GitHub repository local changes authorizing using GitHub token.&lt;/p&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;I am submitting my action under the Wacky Wildcards category.&lt;/p&gt;

&lt;h3&gt;
  
  
  Yaml File or Link to Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/Garvnanwani/github-push-action"&gt;Repository link&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

</description>
      <category>actionshackathon</category>
      <category>github</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
    <item>
      <title>8 Tips for Optimizing Your Website’s Speed</title>
      <dc:creator>Garv Nanwani</dc:creator>
      <pubDate>Tue, 15 Sep 2020 10:05:46 +0000</pubDate>
      <link>https://dev.to/dailydotdev/8-tips-for-optimizing-your-website-s-speed-46da</link>
      <guid>https://dev.to/dailydotdev/8-tips-for-optimizing-your-website-s-speed-46da</guid>
      <description>&lt;p&gt;Have you ever considered the performance of your website, how fast your content loads, and what is the response time of your page? &lt;/p&gt;

&lt;p&gt;All these things should be your priority whenever building any product for real-world users.&lt;/p&gt;

&lt;p&gt;Even a one to two seconds delay on your website can drastically affect the user experience and your site traffic.&lt;br&gt;
Consider any big company such as Amazon or Uber, just a 1-second delay on their website can make them lose hundreds and thousands of customers, a considerable number I know. Now try to apply the same for your website or app.&lt;/p&gt;

&lt;p&gt;Just by taking care of few things and following some best practices, you can make your site a lot faster, and you will see a massive improvement in your product performance.&lt;/p&gt;

&lt;p&gt;So, now let's see what those small details that you can focus on to increase the performance of your website are.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Optimize your media files size and format
&lt;/h3&gt;

&lt;p&gt;We all put images and media files in our page to make it more appealing, but the images and gif files that you put on your site have to be downloaded by the browser to show to your users, so &lt;strong&gt;if you put large-sized images on your site, it will surely make your website slow.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;So it is recommended to use some external picture tools to resize your image and also decrease their size without degrading the quality of your files. For the optimized loading time of your page, it is best to stick to some standard file formats such as jpg, png for images.&lt;/p&gt;

&lt;p&gt;And also, don't try to use images for showing some text stuff; prefer to use text instead because the image will increase unnecessary loading time and won't even help in SEO.  &lt;/p&gt;

&lt;p&gt;These tools can help you achieve this: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://compressor.io/" rel="noopener noreferrer"&gt;https://compressor.io/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google/brotli" rel="noopener noreferrer"&gt;https://github.com/google/brotli&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://tinypng.com/" rel="noopener noreferrer"&gt;https://tinypng.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.gimp.org/" rel="noopener noreferrer"&gt;https://www.gimp.org/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Avoid using inline JS and CSS files
&lt;/h3&gt;

&lt;p&gt;It is an excellent practice to write the JS and CSS code for your website in external files. Not only the external files are easier to maintain, but they are also cached by the browsers to save time on further loads.&lt;/p&gt;

&lt;p&gt;If you define everything in a separate CSS and JS file, the browser will find it easier to apply the styles and functionality to your page.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Write Cleaner HTML
&lt;/h3&gt;

&lt;p&gt;Most of the time, what we do is add unnecessary HTML on our page and fill it with different types of headings, strong and italics tags when we can quickly achieve the same effect with CSS. So rather than putting a lot of code on your HTML file, try to keep it simpler and &lt;strong&gt;use CSS alternatives&lt;/strong&gt;, which will make your page cleaner and more comfortable to load. But it comes on a cost that some old browsers may not support some CSS properties, so make sure you take care of all browsers while writing CSS. &lt;/p&gt;

&lt;h3&gt;
  
  
  4. Load JavaScript files asynchronously or at the end of the page
&lt;/h3&gt;

&lt;p&gt;It's always a good practice to put your script tags just before the body tag closes so that your javascript files load after the whole content part of your webpage is loaded. Or, if you want to put these above the body, then make sure to &lt;strong&gt;put defer attribute inside the script tag&lt;/strong&gt; to make sure the file loads after everything is done loading. It allows the browser to render everything before getting started with JS.&lt;/p&gt;

&lt;p&gt;Also, you can use asynchronous javascript so that it loads parallelly with the content and doesn't disturb the flow of the website. Ajax can help you achieve that so that instead of reloading an entire page when a user acts, we can update parts of that page. You can also put an async attribute on your script tags to load the file asynchronously. &lt;/p&gt;

&lt;h3&gt;
  
  
  5. Utilizing the Browser Caching Feature
&lt;/h3&gt;

&lt;p&gt;A lot of files on your website don't often change with time, &lt;br&gt;
Web caching is when files are cached by the web browser for later use so that when a user revisits your site, the browser doesn't have to load everything from scratch. Things that browsers can cache include CSS files, JavaScript files, and images.&lt;/p&gt;

&lt;p&gt;So, make sure you make a website that takes maximum benefit of the caching feature, the local storage, cookies, and server cache.&lt;/p&gt;

&lt;p&gt;This highly reduces the server response time, and a user can visit your website again and again, and the user experience gets better every time.  &lt;/p&gt;

&lt;p&gt;If you want to learn more about how to leverage browser caching, then check out these articles. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://betterexplained.com/articles/how-to-optimize-your-site-with-http-caching/" rel="noopener noreferrer"&gt;https://betterexplained.com/articles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.codebyamir.com/blog/a-web-developers-guide-to-browser-caching" rel="noopener noreferrer"&gt;https://www.codebyamir.com/blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://varvy.com/pagespeed/leverage-browser-caching.html" rel="noopener noreferrer"&gt;https://varvy.com/pagespeed&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. Minify and Combine your files
&lt;/h3&gt;

&lt;p&gt;All the files that you put on your page have to be downloaded by the browser to render, so by &lt;strong&gt;reducing the number of files, and you automatically make the rendering faster.&lt;/strong&gt; Take into consideration the number of Html, CSS, and JavaScript files on your page. They all add to the number of requests your site makes every time a user visits your page.&lt;/p&gt;

&lt;p&gt;You can reduce this number by "minifying" and combining your files. Minifying the files reduces the size of each file, and combining the files reduces the number of files.&lt;/p&gt;

&lt;p&gt;Minifying a file involves removing unnecessary formatting, whitespace, and code. There are a lot of online tools that can help you achieve the result. Every unnecessary piece of code adds to the size of your page, so it's essential to use minified files to load your page. This ensures that your pages are as clean as possible.&lt;/p&gt;

&lt;p&gt;If your site uses multiple CSS and JavaScript files, you can combine them into one and achieve the same result.  &lt;/p&gt;

&lt;p&gt;Check out these fantastic tools if you want to optimize your files: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I highly recommend using &lt;a href="https://gulpjs.com/" rel="noopener noreferrer"&gt;Gulp&lt;/a&gt; for minimization and optimization of your files, so do check it out.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://yui.github.io/yuicompressor/" rel="noopener noreferrer"&gt;YUI compressor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mishoo/UglifyJS" rel="noopener noreferrer"&gt;UglifyJS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/cssnano/cssnano" rel="noopener noreferrer"&gt;cssnano&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Using the right hosting option and service for your product
&lt;/h3&gt;

&lt;p&gt;When you are doing projects for yourself or demo purposes, it's good to go for free hosting options rather than paying for a domain name and hosting services. Still, once you start making apps for the real world that attracts a significant amount of traffic, it's better to move to a good paid hosting service rather than choosing the cheapest option. Read for reviews of different platforms and choose what suits your needs best.&lt;/p&gt;

&lt;p&gt;Some popular hosting services are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Bluehost&lt;/li&gt;
&lt;li&gt;HostGator Cloud&lt;/li&gt;
&lt;li&gt;DreamHost&lt;/li&gt;
&lt;li&gt;GoDaddy Hosting&lt;/li&gt;
&lt;li&gt;SiteGround&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. Use an online tool like Lighthouse
&lt;/h3&gt;

&lt;p&gt;Once your website is complete, you can go and use any page speed analytics tool available online. If you are using chrome, then there is a &lt;strong&gt;lighthouse tool present in chrome dev tools&lt;/strong&gt;, it gives you analytics about your webpage performance and also provides you some tips with which you can increase your page's performance, so give it a try.  &lt;/p&gt;

&lt;p&gt;And that's it. These were some best practices that, if you start using your webpage, will perform a lot better.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a href="https://api.daily.dev/get?r=devto" rel="noopener noreferrer"&gt;Daily&lt;/a&gt; delivers the best programming news every new tab. We will rank hundreds of qualified sources for you so that you can hack the future.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://api.daily.dev/get?r=devto" rel="noopener noreferrer"&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%2Fi%2Fb996k4sm4efhietrzups.png" alt="Daily Poster"&gt;&lt;/a&gt; &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>design</category>
      <category>css</category>
    </item>
    <item>
      <title>Semantic HTML And Why Does it Matter</title>
      <dc:creator>Garv Nanwani</dc:creator>
      <pubDate>Thu, 03 Sep 2020 15:11:26 +0000</pubDate>
      <link>https://dev.to/dailydotdev/semantic-html-and-why-does-it-matter-4kjh</link>
      <guid>https://dev.to/dailydotdev/semantic-html-and-why-does-it-matter-4kjh</guid>
      <description>&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%2Fi%2Fs5gpqlm4cnwhnuqn22up.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%2Fi%2Fs5gpqlm4cnwhnuqn22up.png" alt="Semantic HTML Meme"&gt;&lt;/a&gt;&lt;br&gt;
Do you use a div tag for enclosing every significant section of your webpage and are tired of maintaining the whole codebase afterward, then I highly suggest you to start using Semantic HTML in your code.&lt;/p&gt;

&lt;h3&gt;
  
  
  So, What is Semantic HTML
&lt;/h3&gt;

&lt;p&gt;Semantic HTML is a way of writing HTML code that's readable, that gives meaning to the webpage rather than just the presentation part.&lt;/p&gt;

&lt;p&gt;It does not affect the way your web page will look, but it certainly will make your code more accessible, making it easier to read for the humans as well as for the machines. &lt;/p&gt;

&lt;p&gt;For example, A &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; tag states that it is a paragraph, so you can guess the content is gonna be a paragraph for sure.  &lt;/p&gt;

&lt;p&gt;But on the other side, a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; tag it can be a navbar, footer, or a hero section. You can't guess this just by looking at it, and that's where the concept of semantic tags comes into place.  &lt;/p&gt;

&lt;p&gt;You write tags that convey something, such as &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;strong&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;em&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And a lot more...  &lt;/p&gt;

&lt;h3&gt;
  
  
  But what's the impact of this?
&lt;/h3&gt;

&lt;p&gt;You might have a question that when there is no major effect on the way my page will look to the audience, then why have an extra headache of caring about the tags I use?&lt;br&gt;
Yeah, it won't matter much for a part of your audience, but for people using a screen reader or for someone going through your code and even for the web crawlers, it matters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of using semantic tags
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Increases the readability and accessibility of your code&lt;/li&gt;
&lt;li&gt;Helps you rank higher in search engine results&lt;/li&gt;
&lt;li&gt;Easier to maintain in a large codebase &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  How do you shift to writing Semantic HTML
&lt;/h3&gt;

&lt;p&gt;There are some basic semantic tags that you should start using from now onwards every time you build a new website replacing the old way of enclosing everything inside a div or span.&lt;/p&gt;

&lt;p&gt;For example, instead of writing a navbar like this: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;div class="nav"&amp;gt;  ...... &amp;lt;/div&amp;gt;&lt;/code&gt;  &lt;/p&gt;

&lt;p&gt;Prefer to use this whenever possible  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;nav&amp;gt; ..... &amp;lt; /nav&amp;gt;&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;Seeing at it anyone can tell this is the nav section of the page and similarily you can use other semantic tags like to breaking the code into different parts that will be easier to manage -  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;header&amp;gt; .... &amp;lt;/header&amp;gt;&lt;/code&gt; will contain the header part of your page  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;footer&amp;gt; .... &amp;lt;/footer&amp;gt;&lt;/code&gt; the footer of your page&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can use a &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; tag to break the content of your page into various sections &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; tag whenever you need to write an article or a long paragraph &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt; tag for the additional information alongside the content or as a sidebar &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;&amp;lt;figure&amp;gt;&lt;/code&gt; for wrapping your image content, and &lt;code&gt;&amp;lt;figcaption&amp;gt;&lt;/code&gt; to write a caption for that image.  &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now let's talk about some lesser-known HTML tags that may be helpful to you in various scenarios - &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; -  pre stands for preformatted text. Sometimes you want to have spaces or line breaks in between your text, which you cant achieve simply using a paragraph tag, so the text inside a pre element preserves both spaces and line breaks and will be displayed exactly as written in the HTML source code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt; - This tag is used when you want to have different images for different media queries; it's most commonly used for responsive designs. Instead of having one image that is scaled up or down based on the viewport, multiple images can be put up to fit the browser viewport.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;details&amp;gt; &amp;amp; &amp;lt;Summary&amp;gt;&lt;/code&gt; - Used to Show/hide content under a collapsible heading without having to use JS. The details tag allows you to put additional details that the user can open and close on demand.&lt;br&gt;
And the summary tag is used with the details to specify a visible heading for the details.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For e.g&lt;br&gt;
&lt;code&gt;&amp;lt;details open&amp;gt;&lt;br&gt;
  &amp;lt;summary&amp;gt;Heading&amp;lt;/summary&amp;gt;&lt;br&gt;
  &amp;lt;p&amp;gt;The content will go here…&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;/details&amp;gt;&lt;/code&gt;  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;datalist&amp;gt; &amp;amp; &amp;lt;option&amp;gt;&lt;/code&gt;- Used to specify a list of predefined options for an input element.So it is used to provide an autocomplete feature to input elements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For e.g.&lt;br&gt;
&lt;code&gt;&amp;lt;datalist&amp;gt; &lt;br&gt;
    &amp;lt;option value="Option 1"&amp;gt;&lt;br&gt;
    &amp;lt;option value="Option 2"&amp;gt;&lt;br&gt;
    &amp;lt;option value="Option 3"&amp;gt;&lt;br&gt;
&amp;lt;datalist&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt; -  Used to display a popup or modal window
This element makes it easy to create popup dialogs and modals on any web page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For e.g.&lt;br&gt;
&lt;code&gt;&amp;lt;dialog open&amp;gt;&lt;br&gt;
  &amp;lt;p&amp;gt;Content goes here...&amp;lt;/p&amp;gt;&lt;br&gt;
&amp;lt;/dialog&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;cite&amp;gt; and &amp;lt;q&amp;gt;&lt;/code&gt; - the &lt;code&gt;&amp;lt;q&amp;gt;&lt;/code&gt; tag is used to specify a quote, and the cite tag defines the title of the work. Often we have to quote something, and simply wrapping the quote inside " " won't give it meaning, so it's best to put the quote inside a &lt;code&gt;&amp;lt;q&amp;gt;&lt;/code&gt;tag and the title inside the cite tag.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; - The time tag is used to define a specific time or date.&lt;br&gt;
Dates and times are formatted differently across the world, and so it becomes difficult to parse through a search engine or email client. So, by enclosing the time information on your page inside a time tag, you make the code machine-readable.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You see how the use of div's and spans is highly reduced, and the code is now much cleaner. That's the power of semantic HTML.&lt;/p&gt;

&lt;p&gt;Writing HTML is easy, but the way you structure your code matters much more than the content, in a way that it's more accessible to everyone and maintainable when the size of the codebase increases on your page. So, Semantic HTML isn't just an option, but it's a necessity, and more people should start considering this when building any web project.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a href="https://r.daily.dev/get?r=devto" rel="noopener noreferrer"&gt;daily.dev&lt;/a&gt; delivers the best programming news every new tab. We will rank hundreds of qualified sources for you so that you can hack the future.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://r.daily.dev/get?r=devto" rel="noopener noreferrer"&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%2Fi%2Fb996k4sm4efhietrzups.png" alt="Daily Poster"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>html</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>What is a PWA and why you should know about it</title>
      <dc:creator>Garv Nanwani</dc:creator>
      <pubDate>Tue, 18 Aug 2020 10:33:27 +0000</pubDate>
      <link>https://dev.to/dailydotdev/what-is-a-pwa-and-why-you-should-know-about-it-31kf</link>
      <guid>https://dev.to/dailydotdev/what-is-a-pwa-and-why-you-should-know-about-it-31kf</guid>
      <description>&lt;p&gt;Have you ever wondered how you can convert your webpage to an app that can run on a mobile phone no matter its Android or iOS?&lt;/p&gt;

&lt;p&gt;Or have you seen that little + (plus) icon at the top of a website, and it makes you wonder how this website is installable? Well, PWA is the answer to your questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is PWA?
&lt;/h2&gt;

&lt;p&gt;PWA's or Progressive Web Apps are a hybrid or say a mix of your regular websites or web pages and a mobile application; they provide you the power of both worlds. And PWA's are getting quite popular these days a significant reason being you don't need to learn another language like Kotlin or flutter to build a mobile app for your product, you can convert your existing website into a mobile application. You can even submit to Google Play and App store. &lt;br&gt;
Of course, you can't compete with a language specifically designed for mobile apps, but still, PWA's come in handy a lot of time, you don't have to code separately for android, ios and browsers. &lt;br&gt;
PWA's have access to all native app features like local storage, cache, push notifications, offline access, and a lot of cool features, so if all this gets you excited, let's dive deeper into it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of PWA
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Cross Platform Support
&lt;/h4&gt;

&lt;p&gt;PWA is browser build and not os build so it can run on any machine, whether it is Android, ios, or your laptop.&lt;/p&gt;

&lt;h4&gt;
  
  
  Speed
&lt;/h4&gt;

&lt;p&gt;PWA is quite faster compared to your standard websites because of the use of service workers, which helps to store the contents of the website in the form of cache on the first time load, making all your further loads significantly faster.&lt;/p&gt;

&lt;h4&gt;
  
  
  Offline Mode
&lt;/h4&gt;

&lt;p&gt;That's the biggest feature standard websites lack, but through the use of service workers, you can load an offline version of your app, or you can cache the data for the first time and provide it for the later loads giving a better user experience.&lt;/p&gt;

&lt;h4&gt;
  
  
  SEO Friendly
&lt;/h4&gt;

&lt;p&gt;In simple words, SEO is a way to make your websites get ranked higher in the search page results, e.g., Google. So, because PWA is technically a website, its content can get indexed and are discoverable on search engines, and because of this, your app can reach a broader audience.&lt;/p&gt;

&lt;h4&gt;
  
  
  Low cost of development
&lt;/h4&gt;

&lt;p&gt;You don't need to hire a web developer and an app developer separately for your project, and you can convert your existing website to a PWA in no time. &lt;/p&gt;

&lt;p&gt;And a lot of others.&lt;/p&gt;

&lt;p&gt;Yes, there are quite a few disadvantages of using a PWA like the browser compatibility issues and the inability to control all features of mobile phones fully, but still, its plus points kind of pay off for all its costs. &lt;/p&gt;

&lt;p&gt;Okay, So enough talk now, let's see what the things that make up a PWA are.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A manifest.json file: This is a JSON file which contains all the information about how your app will look, which initial page to load when your app starts, all the icons which the app should use and it also tells the browser that it's a PWA and how it should behave after being installed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A service worker: A service worker is just a javascript file that runs as soon as your app loads and keeps running in the background. It helps you to control all the network requests, push notifications, cache items, etc.. In short, this script takes care of all the functionality part of your app and thus is the core of any PWA.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A secure HTTPS connection: As, by now, you must have realized PWA's are highly robust, so they only work on trusted connections, to make sure there is no harm to user's data and overall security, and in general to user experience.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it, add these three features to your code, make sure to connect the manifest and service worker file to your HTML. You are good to go. Most browsers detect that your app is a PWA and they give an option of installing it to the home screen when a user visits your site, else you can generate a .apk file for it and publish it to the well known PWA Store or the App Store.&lt;/p&gt;

&lt;p&gt;PWA is a vast topic in itself. There's a lot more to it, but for getting started, these three things are essential, and rest your curiosity will figure it out by itself.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a href="https://r.daily.dev/get?r=devto"&gt;daily.dev&lt;/a&gt; delivers the best programming news every new tab. We will rank hundreds of qualified sources for you so that you can hack the future.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://r.daily.dev/get?r=devto"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GnRWXIbg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/b996k4sm4efhietrzups.png" alt="Daily Poster"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>pwa</category>
      <category>android</category>
      <category>ios</category>
    </item>
    <item>
      <title>Getting Started With Responsive Web Design</title>
      <dc:creator>Garv Nanwani</dc:creator>
      <pubDate>Sat, 08 Aug 2020 09:03:29 +0000</pubDate>
      <link>https://dev.to/dailydotdev/getting-started-with-responsive-web-design-1h39</link>
      <guid>https://dev.to/dailydotdev/getting-started-with-responsive-web-design-1h39</guid>
      <description>&lt;p&gt;Whenever you create any website, you often see the desktop version of it, but what if someone sees it on a smaller screen size like a mobile phone or a tablet, in that case, the design and look of your website can drastically change.&lt;/p&gt;

&lt;p&gt;The main idea behind Responsive Web Design is to make a website that can adapt to any device that is being used to display it. Not only on larger screen sizes but also mobile phones and tablets.&lt;/p&gt;

&lt;p&gt;Most of the users that will visit your website will be using a mobile phone just quickly to go through it, so it becomes necessary for you to make sure your website looks fine in either case otherwise what will happen is your navbar will be going somewhere else, and your main section somewhere else, and at the end the user experience decreases drastically.&lt;/p&gt;

&lt;p&gt;So, here are somethings that you should keep in mind while making any website so that it looks good no matter what the screen size is -   &lt;/p&gt;

&lt;p&gt;One and the most important thing, to begin with, is websites are responsive by default, it's you who makes them unresponsive. For example, you created a div added some text to it, no matter what the screen size is, it will automatically adapt to it. But the moment you add a definite width or height to it, it becomes restricted and thus looks good on some screens and ugly on others, and then what you do is apply a lot of breakpoints and make the code even messier, same goes with images and every other thing.  &lt;/p&gt;

&lt;p&gt;So now let's get started with what the things you should keep in mind while creating a responsive website -&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Viewport
&lt;/h3&gt;

&lt;p&gt;Viewport is the region within the browser that displays the webpage, the viewport changes with the change in screen-size.&lt;br&gt;
If you don't apply the viewport meta tag or any other property, the mobile browsers will render the page at a desktop screen width, and then what will happen is the user will have to zoom in, zoom out to get a perfect fit and the site dimensions will vary from user to user, giving a bad user experience.&lt;/p&gt;

&lt;p&gt;What you can do is apply this meta tag in your head tag,&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1"&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Using this meta viewport tag will make the width=device-width to match the screen's width. This will make sure your content renders properly no matter its a mobile phone or a laptop.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) The layout and flow
&lt;/h3&gt;

&lt;p&gt;Now there are quite a few layout designs in CSS, and understanding the flow of your website and using the best-suited layout for it matters, you can go for a flexbox or a grid layout. Prefers not to use float as it can cause some side effects and then you have to clear and all that, but yeah choose the best layout for your site and design the website such that the elements can stack one after another on smaller screen sizes and you can get smooth user experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) Relative Units
&lt;/h3&gt;

&lt;p&gt;This is an essential aspect of responsive web design, the problem with units like pixels is that it is definite, doesn't matter you view it on a mobile or a laptop, the size will remain the same and its a negative point because 700 px width may be small for a laptop. Still, it won't fit on a mobile phone ever, and your content will overflow here and there.&lt;/p&gt;

&lt;p&gt;So rather than using values in pixels try to use units like em, rem, vw, vh, % which are relative units and have a tendency to adapt to different screens for eg, vw that is viewport width is relative to viewport width of the screen that the website is being viewed on, so its a good practice to use units like these, but make sure you understand the basics of how these units work and where to use which, otherwise it can cause issues.&lt;/p&gt;

&lt;h3&gt;
  
  
  4) Breakpoints
&lt;/h3&gt;

&lt;p&gt;Now, breakpoints are useful in most of the scenarios, but make sure you are using them when required and not unnecessarily using them here and there.&lt;/p&gt;

&lt;p&gt;What you can do is define few media queries, and initially start with bigger breakdowns, open the chrome dev tools go to the device menu and there you can check the responsiveness of your website at a given width and height of the viewport, try to play around with it and find areas where your site is losing responsiveness and mark the breakpoints and apply this method till you get that perfect look on all screen sizes.&lt;/p&gt;

&lt;h3&gt;
  
  
  5) Mobile First or Desktop First
&lt;/h3&gt;

&lt;p&gt;There is a great debate that goes on as to whether to use the mobile-first approach or the desktop first approach while building any website. I believe most of the people coming on your website will be going through your website in mobile so it's better to stick to a mobile-first approach website so that you get the perfect looking website on a mobile and then you can easily set the layout for desktop, and a lot of people say mobile-first is a better way of creating websites, but in some use cases the desktop first website may seem good and at last, it varies according to the project needs and your preference, but if responsiveness is your first priority, then the mobile-first approach will give better results.&lt;/p&gt;

&lt;h3&gt;
  
  
  6) Frameworks
&lt;/h3&gt;

&lt;p&gt;Okay, so what if you are in a hurry, and you cant take all the pain of responsive websites from scratch? You can use a responsive framework like bootstrap, which works on the grid system or Bulma, etc.&lt;/p&gt;

&lt;p&gt;You can use the pre-build components in bootstrap and can get started with a nice looking responsive website without any issue. But on a condition that you know how things work under the hood, for beginners, it is not advised to jump directly to frameworks until you have a solid foundation of CSS; otherwise, there is no benefit of using frameworks, and you will struggle with CSS afterward.&lt;/p&gt;

&lt;p&gt;Well, that's it, there are a lot more things to responsive web design, but for a beginner level you can get started with these, and as you dive deeper into the concepts, you can learn many such more things ;)&lt;/p&gt;

&lt;p&gt;If you liked this article, don't forget to follow me on Twitter, where I share my journey with the world.&lt;/p&gt;

&lt;p&gt;My twitter handle - &lt;a href="https://twitter.com/thisisgarv"&gt;@thisisgarv&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a href="https://r.daily.dev/get?r=devto"&gt;daily.dev&lt;/a&gt; delivers the best programming news every new tab. We will rank hundreds of qualified sources for you so that you can hack the future.&lt;/em&gt;&lt;br&gt;
&lt;a href="https://r.daily.dev/get?r=devto"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GnRWXIbg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/b996k4sm4efhietrzups.png" alt="Daily Poster"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>webdev</category>
      <category>design</category>
      <category>codenewbie</category>
    </item>
  </channel>
</rss>
