<?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: Shashank sharma</title>
    <description>The latest articles on DEV Community by Shashank sharma (@shashannkbawa).</description>
    <link>https://dev.to/shashannkbawa</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%2F506382%2Fb5ed6e7a-3c93-4649-ab45-988c0cedbca1.jpeg</url>
      <title>DEV Community: Shashank sharma</title>
      <link>https://dev.to/shashannkbawa</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shashannkbawa"/>
    <language>en</language>
    <item>
      <title>Deploying Vite App to GitHub Pages</title>
      <dc:creator>Shashank sharma</dc:creator>
      <pubDate>Wed, 26 Jan 2022 10:00:56 +0000</pubDate>
      <link>https://dev.to/shashannkbawa/deploying-vite-app-to-github-pages-3ane</link>
      <guid>https://dev.to/shashannkbawa/deploying-vite-app-to-github-pages-3ane</guid>
      <description>&lt;h2&gt;
  
  
  GitHub Pages
&lt;/h2&gt;

&lt;p&gt;You can use GitHub Pages to showcase some open source projects, host a blog, or even share your resume. This will guide you to get started on creating your next website.&lt;a href="https://pages.github.com/" rel="noopener noreferrer"&gt;Github-pages&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will create a website with a domain, &lt;code&gt;username.github.io&lt;/code&gt;. Eg. Let's consider your &lt;code&gt;username&lt;/code&gt; as &lt;strong&gt;peter101&lt;/strong&gt; and your &lt;code&gt;repo&lt;/code&gt; name as &lt;strong&gt;OnTheGo&lt;/strong&gt;. Then it will make a website with the domain &lt;code&gt;peter101.github.io/OnTheGo/&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps for the Deployment
&lt;/h2&gt;

&lt;p&gt;The following steps must be followed in serial-wise.&lt;/p&gt;

&lt;p&gt;We will create a seperate &lt;code&gt;gh-pages&lt;/code&gt; branch that will contain our &lt;em&gt;/dist&lt;/em&gt; folder.&lt;/p&gt;

&lt;h4&gt;
  
  
  Push your code to your repository (using Terminal)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;cd to your Vite App.&lt;/li&gt;
&lt;li&gt;Run the following commands in your Terminal

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;$ git init&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$ git add .&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$ git commit -m "first-commit"&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$ git branch -M main&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$ git remote add origin http://github.com/username/repo-name.git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$ git push -u origin main&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, you will able to see your code in your repository.&lt;/p&gt;

&lt;h4&gt;
  
  
  Deploying (Static)
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Go to your &lt;code&gt;vite.config.js&lt;/code&gt; file. And add your base url to it.&lt;/li&gt;
&lt;/ol&gt;

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

&lt;p&gt;To be more precise, your base url will be &lt;strong&gt;/repo-name/&lt;/strong&gt;. &lt;br&gt;
In my case, my &lt;code&gt;repo-name&lt;/code&gt; is &lt;code&gt;Tech-To&lt;/code&gt;. So, my base url will be &lt;strong&gt;/Tech-To/&lt;/strong&gt;.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;npm run build&lt;/code&gt; in your Terminal.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;By default, the build output will be placed at dist. You may deploy this dist folder to any of your preferred platforms.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Add &lt;em&gt;/dist&lt;/em&gt; folder into your repo. By running.
```
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;$ git add dist -f&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
`-f` is required, as your **.gitignore** will not consider your _/dist_ folder. Hence, it is required for git to consider it as well.


4. Run `$ git commit -m "Adding dist"` in your Terminal.


5. Run `$ git subtree push --prefix dist origin gh-pages`


##Your Deployed website


- Visit your repository.
- Go to Settings.
- Scroll down to **Pages**.
- There will be a link to your website.


####You did it!!



![congo](https://media.giphy.com/media/g9582DNuQppxC/giphy-downsized-large.gif)

![congo](https://media.giphy.com/media/xT0xezQGU5xCDJuCPe/giphy.gif)




&amp;gt;#####Thank You for referring to this post. Your comments will be helpful for the betterment of this post.




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

&lt;/div&gt;

</description>
      <category>vite</category>
      <category>githubpages</category>
      <category>git</category>
      <category>deploy</category>
    </item>
    <item>
      <title>DarkMode in TailWind</title>
      <dc:creator>Shashank sharma</dc:creator>
      <pubDate>Mon, 24 Jan 2022 12:00:18 +0000</pubDate>
      <link>https://dev.to/shashannkbawa/darkmode-in-tailwind-1i1n</link>
      <guid>https://dev.to/shashannkbawa/darkmode-in-tailwind-1i1n</guid>
      <description>&lt;p&gt;So I am writing this post as I have faced some problems while using dark mode in my website with the help of TailwindCSS.&lt;/p&gt;

&lt;p&gt;I wanted to toggle between light mode and dark mode manually.&lt;/p&gt;

&lt;p&gt;So please allow me to tell the whole story behind creation of simple Dark mode.&lt;/p&gt;

&lt;h3&gt;
  
  
  List of Contents
&lt;/h3&gt;

&lt;p&gt;1.Prerequiste (things that you have to do before using darkmode)&lt;br&gt;
2.Toggle button&lt;br&gt;
3.Toggle Theme (Functionality)&lt;br&gt;
4.What changes can we make to &lt;code&gt;className&lt;/code&gt; for darkmode&lt;br&gt;
5.Temprory Functioning&lt;/p&gt;
&lt;h2&gt;
  
  
  Prerequisite (things that you have to do before using darkmode)
&lt;/h2&gt;

&lt;p&gt;As it has also been stated in the Tailwind documentaion of darkmode . Add &lt;code&gt;darkMode: 'class',&lt;/code&gt; in your tailwind.config.js like this below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  darkMode: 'class',
  // ...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It basically add &lt;code&gt;class=" "&lt;/code&gt; into your HTML.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Bro, but why ain't we using &lt;code&gt;media&lt;/code&gt; instead of &lt;code&gt;class&lt;/code&gt;?&lt;/em&gt; .&lt;br&gt;
 The thing is &lt;code&gt;media&lt;/code&gt; will take your OS color scheme into consideration and &lt;code&gt;class&lt;/code&gt; will let you add it manually. So,  that's the theory behind it.👍&lt;/p&gt;
&lt;h2&gt;
  
  
  Toggle button
&lt;/h2&gt;

&lt;p&gt;It basically makes a button that listens to a &lt;code&gt;onClick&lt;/code&gt; function on clicking it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className='flex items-center justify-center inline-flex '&amp;gt;
      &amp;lt;label className='pt-0 pb-1 w-10 mb-6 ' &amp;gt;
             &amp;lt;div className='w-12 h-5 border-2 justify-center 
                             items-center rounded-lg bg-#172d42 
                             mt-1 absolute' type='checkbox' /&amp;gt;
             &amp;lt;input onClick={theme} className='bg-[#ffffff] w-7 h-7
                                              flex justify-center items-center
                                              duration-500 checked:translate-x-6
                                              checked:bg-black appearance-none
                                              rounded-full absolute ease-in-out' type='checkbox' &amp;gt;
             &amp;lt;/input&amp;gt;
      &amp;lt;/label&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;You can change the &lt;code&gt;className&lt;/code&gt; values according to your CSS. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So here, &lt;code&gt;checked&lt;/code&gt; means that, when the checkbox input is checked, it will &lt;code&gt;translate-x-6&lt;/code&gt; translate in x-axis i.e. toward right. And the rest is basic tailwind CSS. You can search the meaning of the values of &lt;code&gt;className&lt;/code&gt; in their &lt;a href="https://tailwindcss.com/"&gt;website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main Thing&lt;/strong&gt; We have passed &lt;code&gt;theme&lt;/code&gt; to the &lt;code&gt;onClick&lt;/code&gt; function. About which, we will talk later. &lt;/p&gt;

&lt;p&gt;The button will look like this ...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_-SeB8mO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u23xcoxo0hly25qngyxi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_-SeB8mO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u23xcoxo0hly25qngyxi.png" alt="Image description" width="75" height="43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Toggle Theme (Functionality)
&lt;/h2&gt;

&lt;p&gt;Here, you are required to use &lt;code&gt;useState&lt;/code&gt; hooks from &lt;a href="https://reactjs.org/docs/hooks-intro.html"&gt;react&lt;/a&gt;. But first, let me introduce you to my code then we will talk about it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [theme, setTheme] = useState('light');

const toggleTheme = () =&amp;gt; {

    if (theme === 'dark') {
      document.documentElement.classList.remove('dark')
      setTheme('light')
      localStorage.theme = 'dark'
    } else {
      document.documentElement.classList.add('dark')
      setTheme('dark')
      localStorage.theme = 'light'
    }
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initially, I have set the &lt;code&gt;theme&lt;/code&gt; state to 'light'. I wanted that user must first see the light mode and then toggle to the dark mode. But, if you want the user to see the dark mode first then set it to 'dark'.&lt;br&gt;
 &lt;code&gt;const [theme, setTheme] = useState('dark');&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I used normal if else statement, for beginners understanding. You can also use ternary operator {  ? &amp;lt;&amp;gt; : &amp;lt;&amp;gt; } .&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You have plenty of options with JavaScript. That's the beauty of it. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;But dude, tell us more, what does&lt;/em&gt; &lt;code&gt;document.documentElement.classList.add('dark')&lt;/code&gt; &lt;em&gt;do&lt;/em&gt;.&lt;br&gt;
 It basically adds &lt;code&gt;class="dark"&lt;/code&gt; into your HTML.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9HyNvVcR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezbp8bjcp442fon7m4xi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9HyNvVcR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ezbp8bjcp442fon7m4xi.png" alt="Image description" width="446" height="41"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And &lt;code&gt;document.documentElement.classList.remove('dark')&lt;/code&gt; will make it back to the normal.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Z19BWR6c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/imt4fyoxqhlpsftyq8jm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z19BWR6c--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/imt4fyoxqhlpsftyq8jm.png" alt="Image description" width="469" height="31"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, next comes the &lt;code&gt;localStorage.theme = 'dark'&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API"&gt;localStorage&lt;/a&gt; ,an API that allows you to store key-value pairs of data that persist with page reloads as well as when the browser window is closed and reopened.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You can read the official documentation of &lt;code&gt;localStorage&lt;/code&gt; from Mozilla. Basically, it will store the value of the &lt;code&gt;theme&lt;/code&gt; in your browser for local reference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The main monopoly behind this &lt;code&gt;toggleTheme&lt;/code&gt; is&lt;/strong&gt;&lt;br&gt;
 The user clicks on the button. That will invoke &lt;code&gt;toggleTheme&lt;/code&gt; and it will check, if the theme is dark, then remove 'dark' from HTML and &lt;code&gt;setTheme&lt;/code&gt; to 'light' and set &lt;code&gt;localStorage.theme&lt;/code&gt; to light.&lt;br&gt;
And, if user again clicks on the button, then it will again invoke &lt;code&gt;toggleTheme&lt;/code&gt; and this time the theme is set to 'light' then the else part will execute. That will add 'dark' to HTML and &lt;code&gt;setTheme&lt;/code&gt; to 'dark' and set &lt;code&gt;localStorage.theme&lt;/code&gt; to dark.&lt;/p&gt;

&lt;p&gt;So, now I think you would be comfortable with the functioning behind &lt;code&gt;toggleTheme&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Then, where to put this&lt;/em&gt; &lt;code&gt;toggleTheme&lt;/code&gt; &lt;em&gt;function?&lt;/em&gt; React comes to the rescue &lt;br&gt;
&lt;a href="https://i.giphy.com/media/iJHzVfDR5WXPVgZJyS/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/iJHzVfDR5WXPVgZJyS/giphy.gif" alt="rescue" width="480" height="270"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://i.giphy.com/media/f8VxRaHxaTqkOUgywz/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/f8VxRaHxaTqkOUgywz/giphy.gif" alt="rescue" width="480" height="270"&gt;&lt;/a&gt;&lt;br&gt;
I wrote this in my &lt;code&gt;App.jsx&lt;/code&gt;. So that, it would be easy to pass the props to the other components.&lt;/p&gt;

&lt;p&gt;You have to pass the theme into your components. I did it like this&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;Navbar theme={toggleTheme} /&amp;gt;&lt;/code&gt; in my App.jsx&lt;/p&gt;

&lt;p&gt;My Navbas.jsx&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Navbar = ({ theme }) =&amp;gt; {
    return(
        &amp;lt;&amp;gt;
        &amp;lt;/&amp;gt;
        //rest of the code
    )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and used it in my &lt;code&gt;onClick&lt;/code&gt; function, about that I have mentioned earlier.&lt;br&gt;
&lt;code&gt;&amp;lt;input onClick={theme} className='bg-[#ffffff]' type='checkbox' &amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  What changes can we make to &lt;code&gt;className&lt;/code&gt; for darkmode
&lt;/h2&gt;

&lt;p&gt;If you wanted to change the text, background and other values, with the help of darkmode of TailwindCSS, you can do it simply by adding &lt;code&gt;dark:text-white&lt;/code&gt; in your &lt;code&gt;className&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className='text-black dark:text-white'&amp;gt;

&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it folks, you will now be able to see the button and toggle between the light theme and dark theme.🎉&lt;/p&gt;

&lt;h2&gt;
  
  
  Temprory Functioning
&lt;/h2&gt;

&lt;p&gt;A basic illustration of dark mode with ReactJS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';

const DarkMode = () =&amp;gt; {

    const [theme, setTheme] = useState('light');

    const toggleTheme = () =&amp;gt; {

        if (theme === 'dark') {
            document.documentElement.classList.remove('dark')
            setTheme('light')
            localStorage.theme = 'dark'
        } else {
            document.documentElement.classList.add('dark')
            setTheme('dark')
            localStorage.theme = 'light'
        }
    }
    return &amp;lt;div className='mt-7 max-w-full m-h-full bg-black dark:bg-slate-700 flex items-center justify-center  '&amp;gt;
        &amp;lt;label className='pt-0 pb-1 w-10 mb-6 ' &amp;gt;

            &amp;lt;div className='w-12 h-5 border-2 justify-center items-center rounded-lg bg-#172d42 mt-1 absolute' type='checkbox' /&amp;gt;
            &amp;lt;input onClick={toggleTheme} className='bg-yellow-200 w-7 h-7  flex justify-center items-center duration-500 checked:translate-x-6 checked:bg-black appearance-none rounded-full absolute ease-in-out' type='checkbox' &amp;gt;
            &amp;lt;/input&amp;gt;


        &amp;lt;/label&amp;gt;
        &amp;lt;h1 className='mx-5 text-white dark:text-red-900'&amp;gt;Heyyy there&amp;lt;/h1&amp;gt;

    &amp;lt;/div&amp;gt;
        ;
};

export default DarkMode;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NYtBmaWq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://play.vidyard.com/zvU5319QsCAUaWshwh9kqD.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NYtBmaWq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://play.vidyard.com/zvU5319QsCAUaWshwh9kqD.jpg" alt="Dark Mode" width="640" height="305"&gt;&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;If you wanted to see the functioning of dark and light mode, then you can check this website &lt;a href="https://shashannkbawa.github.io/Shanks-Web3.0/"&gt;https://shashannkbawa.github.io/Shanks-Web3.0/&lt;/a&gt;&lt;br&gt;
And can also refer to the code in my &lt;a href="https://github.com/shashannkbawa/Shanks-Web3.0"&gt;Github repo&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Let me know if there is a better approach. For now this works. Refer the tailwind docs for more info. &lt;a href="https://tailwindcss.com/"&gt;TailwindCSS&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>tailwindcss</category>
      <category>darkmode</category>
      <category>react</category>
    </item>
    <item>
      <title>Journey to my first React app</title>
      <dc:creator>Shashank sharma</dc:creator>
      <pubDate>Thu, 17 Jun 2021 12:54:25 +0000</pubDate>
      <link>https://dev.to/shashannkbawa/journey-to-my-first-react-app-39m9</link>
      <guid>https://dev.to/shashannkbawa/journey-to-my-first-react-app-39m9</guid>
      <description>&lt;p&gt;Building an app from scratch is much more than how it looks.&lt;br&gt;
It is not that difficult. But for me, as a newbie, it is something difficult.&lt;br&gt;
Let's divide my journey into three parts.&lt;/p&gt;

&lt;ul&gt;

&lt;li&gt;About the Project&lt;/li&gt;
&lt;li&gt;Problems I faced and debugged&lt;/li&gt;
&lt;li&gt;End&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;About the Project&lt;/h2&gt;

&lt;p&gt;
We all have been looking for a place where we can sit and enjoy the music. After a hectic day, there is still a place where we can enjoy the peace. For some of us it's a Home, for some it's their loved ones.&lt;/p&gt;

&lt;p&gt;Quoting Jiraiya Sensei - &lt;b&gt;A place where someone thinks about you is a place you can call Home.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;As we all have gone through a lot in this pandemic. So why not we just relax for a while and have a deep breath and just Relax.....&lt;/p&gt;



&lt;h2&gt;Problems I faced and debugged&lt;/h2&gt;


&lt;p&gt;At first, I thought of using the background as a component. But after including other components, they do not overlap. So I Googled this problem and came to know that there are two basic solutions&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;By using Overlay&lt;/li&gt;
&lt;li&gt;By changing z-index&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;But I was unable to apply both the solution. So I came with a cringey solution i.e. by applying the image in CSS. Then I used &lt;code&gt;background-image : url(/xyz.jpg); &lt;/code&gt; in my CSS.And now the components overlap as I wished. It worked fine but a new problem arrived at the same moment. The background image is zoomed to its maximum height and width. To overcome this , I wrote &lt;code&gt;background-size : cover;&lt;/code&gt; which I think worked best for me.&lt;br&gt;
Then I made a &lt;code&gt;Navbar&lt;/code&gt; component. It worked fine😊.&lt;br&gt;
Then after doing some more code , I thought of an idea💡. Is that - Why don't I make the words coming on the screen more real that someone is typing that sentences? Then I Googled , and the library I used is &lt;code&gt;React Typist&lt;/code&gt;. You can also try this on by going to the npm site.&lt;br&gt;
I used that in my &lt;code&gt;Type&lt;/code&gt; component. And by reading their documentation , I easily applied that on my App.&lt;br&gt;
Then I put a &lt;code&gt;sound&lt;/code&gt; component in my App. And the package I used is &lt;code&gt;react-audio-player&lt;/code&gt; from &lt;a href="https://www.npmjs.com/package/react-audio-player" rel="noopener noreferrer"&gt;npm&lt;/a&gt;. And by applying some changes to the code, now I can see audio bar on my App. &lt;/p&gt;

&lt;p&gt;The problem now popped is that I wasn't able to add a URL to the player. I have downloaded a music file on my PC. It is in the same folder where my components are, but passing the file location to the URL is not enough to make the player work.&lt;/p&gt;
&lt;br&gt;

&lt;blockquote&gt;
&lt;p&gt;Programmers ability is - whenever they face any problem in their code. They Google.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And I did the same , some of them says "Use the location of the music as a variable and then use the variable in your code". Actually, it didn't work. 😵&lt;br&gt;
Spending some hours on this problem is making me more and more frustrated. Then I thought of using another package for the same. But I got stuck on the same problem until I realized the basic rule.&lt;br&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;During the time of coding if you ever stuck in a problem for a long time. Just think from the start again and ask yourself the 5 W's and H. Then you will definitely find your way.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;p&gt;So again, I did the same, fundamentally what I need - a URL, for what - for using it in my App. So I came with a solution. It might be a legal or illegal thing. I don't know. But a very simple solution i.e.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt; just google "Download xyz mp3" or from wherever you can download, just go to that download link.😤&lt;/li&gt;
&lt;li&gt;Inspect that download link.&lt;/li&gt;

&lt;li&gt;That's your URL.&lt;/li&gt;
&lt;/ol&gt;
&lt;br&gt;
&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fibjg9ttqrs5pxsz9st65.png" alt="oie_xsTIxpyKijWW"&gt;&lt;br&gt;
Then after that everything seems fine. But the main problem is still waiting for me. I wasn't aware of that but it is waiting.....⏳

&lt;p&gt;Back to my story,&lt;br&gt;
As everything is working fine till now , So I thought of making my App responsive. Then I started working on &lt;code&gt;@media queries&lt;/code&gt;. I wrote pretty well &lt;code&gt;@media queries&lt;/code&gt;. After writing &lt;code&gt;@media queries&lt;/code&gt; I was sure that this App is not made for portrait phones. Then I thought that why shouldn't I make a prompt that makes the user rotate his/her phone. After that, my brain cells start working on that thing. And again, the first problem arose, that is, my component isn't overlapping. Then I Googled the best way to ask a user to rotate his/her phone. But the answers are for React-native. I was working on React only. So after some more Googling, I came across a package that gets the orientation from the user.&lt;code&gt;use-window-orientation&lt;/code&gt;. &lt;a href="https://www.npmjs.com/package/use-window-orientation" rel="noopener noreferrer"&gt;Goto&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some of you might think - &lt;em&gt;"Ayo, why don't you just use &lt;code&gt;screen.height&lt;/code&gt; and &lt;code&gt;screen.width&lt;/code&gt; to get the pixels information and do this"&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (screen.width &amp;gt; screen.height ) {
    return landscape;
} else {
    return portrait;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yes, I came up with that solution also, but that was after solving the problem.&lt;br&gt;
So,&lt;br&gt;
In the documentation they explained the use in some other way but I prefer a different technique. I use &lt;strong&gt;Conditional Rendering&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;const { portrait } = useWindowOrientation();
    if (portrait) {
        return &amp;lt;Rotate /&amp;gt;
    }
    else {
        return (
            &amp;lt;div className = "Home"&amp;gt;
                &amp;lt;Navbar /&amp;gt;
                &amp;lt;Type /&amp;gt;
                &amp;lt;Music /&amp;gt;
            &amp;lt;/div&amp;gt;
        )
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's the solution folks.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03ut6x1d96l2qvq1rwi2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F03ut6x1d96l2qvq1rwi2.jpg" alt="you-can-do-it"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;End&lt;/h2&gt;

&lt;p&gt;I was so happy to tell my friend about this problem and I solved it. This is just a basic start of this project, I have many more things to do in this project. For some pro developers, these problems might not count in their problemsList. But I write this article for some newbies like me out there who are still struggling to find their way in their problems.&lt;br&gt;
You can check my github repo for this project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The beginning is the end and the end is the beginning. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thank you folks for reading this article.&lt;/p&gt;

&lt;p&gt;👇🌝 &lt;br&gt;
&lt;a href="https://github.com/shashannkbawa/relax" rel="noopener noreferrer"&gt;GitHub-repo&lt;/a&gt; &lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>debug</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
