<?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: Mohamed Amine Fh</title>
    <description>The latest articles on DEV Community by Mohamed Amine Fh (@medaminefh).</description>
    <link>https://dev.to/medaminefh</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%2F310144%2Fe8c45be3-10d5-44e6-ad44-11fc5fcb6807.jpg</url>
      <title>DEV Community: Mohamed Amine Fh</title>
      <link>https://dev.to/medaminefh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/medaminefh"/>
    <language>en</language>
    <item>
      <title>What happens when you enter a URL in your browser?</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Fri, 09 Feb 2024 19:17:58 +0000</pubDate>
      <link>https://dev.to/medaminefh/what-happens-when-you-enter-a-url-in-your-browser-15f7</link>
      <guid>https://dev.to/medaminefh/what-happens-when-you-enter-a-url-in-your-browser-15f7</guid>
      <description>&lt;p&gt;Have you ever wondered what happens when you open your browser(Chrome, Firefox, ...) type your preferred website, and hit &lt;strong&gt;Enter&lt;/strong&gt;?&lt;/p&gt;

&lt;h4&gt;
  
  
  What is going on behind the scenes?
&lt;/h4&gt;

&lt;p&gt;In this blog, we'll cover what happens there.&lt;/p&gt;

&lt;p&gt;before we get started we need to understand a few things &lt;strong&gt;IP addresses&lt;/strong&gt;, &lt;strong&gt;servers&lt;/strong&gt;, &lt;strong&gt;DNS&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is an IP address?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxnp65kual1j94qes0vp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxnp65kual1j94qes0vp.jpg" alt="Ip address" width="275" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An IP address is a &lt;strong&gt;unique&lt;/strong&gt; address that &lt;strong&gt;identifies a device on the internet or a local network&lt;/strong&gt;. IP stands for "Internet Protocol," which is the set of rules governing the format of data sent via the Internet or local network.&lt;/p&gt;

&lt;p&gt;It is a string of numbers separated by periods. IP addresses are expressed as a set of four numbers — an example address might be &lt;code&gt;192.158.1.38&lt;/code&gt;. Each number in the set can range from 0 to 255. So, the full IP addressing range goes from &lt;code&gt;0.0.0.0&lt;/code&gt; to &lt;code&gt;255.255.255.255&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;-So every computer connected to the internet is assigned to a &lt;strong&gt;unique&lt;/strong&gt; IP address-.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a server?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwlfgw2qcnkdsctmk1ft.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwlfgw2qcnkdsctmk1ft.jpg" alt="data center servers" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A server is a computer or system that provides resources, data, services, or programs to other computers, known as clients, over a network.&lt;/p&gt;

&lt;p&gt;In simple terms, a server is a computer (laptop, desktop, smartwatch, smartphone, ...) that can communicate with other computers.&lt;br&gt;
In most cases nowadays we refer to servers as those that exist in the cloud provided by giant data center companies (Google, Facebook, Amazon, ...).&lt;/p&gt;

&lt;h3&gt;
  
  
  What is a DNS?
&lt;/h3&gt;

&lt;p&gt;The Domain Name System (DNS) is a special server that works as a phonebook of the Internet. Humans access information online through domain names, like &lt;code&gt;google.com&lt;/code&gt;. DNS translates domain names to IP addresses.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs70f3oridb4cweulmd2e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs70f3oridb4cweulmd2e.png" alt="DNS server" width="547" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each device connected to the Internet has a unique IP address (as we mentioned above) which other computers use to find the device. DNS servers eliminate the need for humans to memorize IP addresses such as &lt;code&gt;12.45.56.67&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;so think of DNS as a translator from human-readable domain names to computer-readable IP addresses.&lt;/p&gt;

&lt;p&gt;So after we cover the above concepts it should be easier for us to understand the rest.&lt;/p&gt;

&lt;h3&gt;
  
  
  TCP/IP connection
&lt;/h3&gt;

&lt;p&gt;When you type &lt;code&gt;https://www.google.com&lt;/code&gt; in your browser, your browser will go to the DNS, get the IP address associated with that URL, and start a TCP/IP connection with the server that has that IP address.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web servers
&lt;/h3&gt;

&lt;p&gt;A web server is a computer that runs websites. It’s a computer program(must be installed) that distributes web pages. The basic objective of the web server is to store, process, and deliver web pages to users(web browsers). This intercommunication is done using Hypertext Transfer Protocol (HTTP).&lt;/p&gt;

&lt;p&gt;examples of web servers are &lt;strong&gt;Nginx, Apache&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP(s) connection
&lt;/h3&gt;

&lt;p&gt;websites are transferred through the &lt;code&gt;HTTP protocol&lt;/code&gt;, the secure version of that protocol is the &lt;code&gt;HTTPS protocol&lt;/code&gt; which tells the browser to make a secure connection with the server using the &lt;strong&gt;Transport Layer Security (TLS)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;With TLS data exchanged between the browser and the server (password, credit card) is encrypted.&lt;/p&gt;

&lt;p&gt;Now that the browser has a connection (TCP/IP) to the server it will follow the HTTP&lt;small&gt;(s)&lt;/small&gt; protocol,&lt;br&gt;
so It will send an HTTP request to the server requesting the necessary static files at that location (HTML, CSS, JS, Images, ...).&lt;/p&gt;

&lt;p&gt;The server could contain an &lt;strong&gt;application server&lt;/strong&gt; that delivers dynamic content instead of static one based on database data like user profiles or real-time updates like chat messages.&lt;/p&gt;

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

&lt;p&gt;If the request is understood by the server, the server will send back the files to the browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  Web server VS App server
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe624iy2bi0s4xxzgha5p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe624iy2bi0s4xxzgha5p.png" alt="Web server VS App server" width="421" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A web server delivers static web content—e.g., HTML pages, files, images, video—primarily in response to hypertext transfer protocol (HTTP) requests from a web browser.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An application server typically can deliver web content too, but its primary job is to enable interaction between end-user clients and server-side application code—the code representing what is often called business logic—to generate and deliver dynamic content, such as transaction results, decision support, or real-time analytics&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Databases
&lt;/h3&gt;

&lt;p&gt;A database is information that is set up for easy access, management and updating. Computer databases typically store aggregations of data records or files that contain information, such as sales transactions, customer data, financials and product information.&lt;/p&gt;

&lt;p&gt;Databases are used for storing, maintaining and accessing any sort of data. They collect information on people, places or things. That information is gathered in one place so that it can be observed and analyzed. Databases can be thought of as an organized collection of information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Presenting the content by the browser
&lt;/h3&gt;

&lt;p&gt;After the server sends back the files, the browser understands how to present the content and starts presenting the content to the user.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwq4vwcp2g7ry4hys26d3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwq4vwcp2g7ry4hys26d3.jpg" alt="Renders content in browser" width="800" height="480"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;That's a pretty straightforward/classic scenario when you type a URL in the browser. nowadays many threats are threatening the internet, Cyber attacks have been rated the fifth top-rated risk in 2020 and become the new norm across public and private sectors.&lt;/p&gt;

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




&lt;p&gt;Therefore the connection to the internet nowadays consists of new layers of security including but not limited to &lt;strong&gt;Load-balancer&lt;/strong&gt;, &lt;strong&gt;Firewall&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Load balancer
&lt;/h3&gt;

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

&lt;p&gt;A load balancer acts as the “traffic cop”👮 sitting in front of your servers and routing client requests across all servers capable of fulfilling those requests in a manner that maximizes speed and capacity utilization and ensures that no one server is overworked, which could degrade performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Firewall
&lt;/h3&gt;

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

&lt;p&gt;A firewall is a network security device that monitors incoming and outgoing network traffic and decides whether to allow or block specific traffic based on a defined set of security rules.&lt;/p&gt;




&lt;h4&gt;
  
  
  You made it to the end 👏👏. Now you have a clear idea of what will happen next time when you type a URL and hit Enter
&lt;/h4&gt;




&lt;h3&gt;
  
  
  Thanks for reading
&lt;/h3&gt;

</description>
      <category>webdev</category>
      <category>data</category>
      <category>tutorial</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Clear All pinia stores</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Fri, 12 May 2023 11:09:09 +0000</pubDate>
      <link>https://dev.to/medaminefh/clear-all-pinia-stores-9kd</link>
      <guid>https://dev.to/medaminefh/clear-all-pinia-stores-9kd</guid>
      <description>&lt;p&gt;&lt;strong&gt;Pinia&lt;/strong&gt; is a store library and state management framework for &lt;strong&gt;Vue.js&lt;/strong&gt;. Designed primarily for building front-end web applications, it uses declarative syntax and offers its own state management API. it released on November 2019, so let's say it's new to the tech industry.&lt;/p&gt;

&lt;p&gt;In this blog i won't share how to use and create Pinia stores you can check that in the &lt;a href="https://pinia.vuejs.org/introduction.html"&gt;docs&lt;/a&gt;, but i'm gonna show you how to clear or reset all pinia stores at once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One of the cases where you want to reset all stores&lt;/strong&gt; is when you have for example a social media platform and the user logged out, you don't want to keep the last user's data stored in pinia right, so that's where you need to clear all stores.&lt;/p&gt;

&lt;p&gt;At the time were this blog is created pinia does not have a built-in function that reset all the stores in its &lt;a href="https://pinia.vuejs.org"&gt;official docs&lt;/a&gt;, we hope they'll provide one soon.&lt;/p&gt;

&lt;p&gt;So what is the solution here ? one solution i come up with is by resetting the stores one by one, so for example let's say you've created &lt;code&gt;3 pinia stores&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;userStore
postsStore
followersStore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We need to go to each of these stores and &lt;code&gt;$reset&lt;/code&gt; them one by one, and this achieved 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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getActivePinia&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="s2"&gt;pinia&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;// map through that list and use the **$reset** fn to reset the state&lt;/span&gt;
&lt;span class="nf"&gt;getActivePinia&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;_s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;store&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;$reset&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See this is the github discussion &lt;a href="https://github.com/vuejs/pinia/discussions/911"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>pinia</category>
      <category>vue</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How To use ES6 import &amp; export in your project</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Sat, 02 Jul 2022 20:52:35 +0000</pubDate>
      <link>https://dev.to/medaminefh/how-to-use-es6-import-export-in-your-project-3i4b</link>
      <guid>https://dev.to/medaminefh/how-to-use-es6-import-export-in-your-project-3i4b</guid>
      <description>&lt;h4&gt;
  
  
  Hello Everyone, I hope you're doing well
&lt;/h4&gt;



&lt;h4&gt;
  
  
  So After that being said, let's start our blog, so in this blog you'll learn how to use the ES6 features on your client or server project
&lt;/h4&gt;





&lt;h4&gt;
  
  
  Frontend aka Client
&lt;/h4&gt;

&lt;p&gt;You've an &lt;code&gt;index.html&lt;/code&gt;  file and some &lt;code&gt;css&lt;/code&gt; and &lt;code&gt;js&lt;/code&gt; files, and for most cases you want to separate  your Javascript code into multiple files and just  import the necessary code into your main file let's say &lt;code&gt;script.js&lt;/code&gt;. &lt;/p&gt;



&lt;p&gt;The old way is to link those files in your html file and your main js file linked the last,&lt;br&gt;
for exp you have these js files&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;script.js
keys.js
utils.js
anotherFile.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and let's say your &lt;code&gt;script.js&lt;/code&gt; is the main one, the &lt;code&gt;anotherFile.js&lt;/code&gt; is depending on the &lt;code&gt;utils.js&lt;/code&gt; and the &lt;code&gt;utils.js&lt;/code&gt; is depending on &lt;code&gt;keys.js&lt;/code&gt; (depending word here means, that file is importing some data or needing some data from the other file)&lt;/p&gt;



&lt;p&gt;this is what it would look like on your html file (index.html) to make your code work&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%2Fdrive.google.com%2Fuc%3Fid%3D15yJyTxFbW4NIk98FcWvzM-EIRj7RSwQH" 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%2Fdrive.google.com%2Fuc%3Fid%3D15yJyTxFbW4NIk98FcWvzM-EIRj7RSwQH" alt="scripts tag"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;You probably said what is the problem , right? &lt;/p&gt;

&lt;p&gt;so in our case here we have a few js files, imagine that you've a big project to work on and let's say 20 js files in your project &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%2Fc.tenor.com%2FoSASxe-6GesAAAAC%2Fspongebob-patrick.gif" 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%2Fc.tenor.com%2FoSASxe-6GesAAAAC%2Fspongebob-patrick.gif" alt="Panic gif"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;I feel you LOL, &lt;/p&gt;

&lt;p&gt;so we need to find a Solution, Fortunately there is a solution&lt;/p&gt;

&lt;p&gt;Using the ES6  imports &amp;amp; exports (You could use the old ES5 require, but here we'll use a more modern one)&lt;/p&gt;



&lt;p&gt;Just we need one script file to include in our html file and in that  javascript file we'll include all other features or codes from other files.&lt;/p&gt;

&lt;p&gt;1st thing to do is making our file a module so we can use the ES6 features, and that it can be done with the &lt;code&gt;type&lt;/code&gt;  attribute in script tag &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;script type="module"  src="script.js"&amp;gt; &amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/p&gt;



&lt;p&gt;and in your files you could export and import other function or anything like so &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%2Fdrive.google.com%2Fuc%3Fid%3D1czBdL17umDuqpY4dFO-aFFJmhBwJbp_e" 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%2Fdrive.google.com%2Fuc%3Fid%3D1czBdL17umDuqpY4dFO-aFFJmhBwJbp_e" alt="Export and import in ES6"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;And that's it for the frontend&lt;/p&gt;

&lt;h4&gt;
  
  
  Backend aka Server
&lt;/h4&gt;

&lt;p&gt;for the server is by the &lt;code&gt;package.json&lt;/code&gt; file (created with the npm init), in that file add a type key and module as its value like this&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%2Fdrive.google.com%2Fuc%3Fid%3D18fQh1tBq531n2DUcCAepNlm6dTZt5acC" 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%2Fdrive.google.com%2Fuc%3Fid%3D18fQh1tBq531n2DUcCAepNlm6dTZt5acC" alt="package.json file"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;Yeap That's very much it, you're all set up to use new ES6 feature and speed your development process&lt;/p&gt;

&lt;h1&gt;
  
  
  Happy_coding
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Passing Components as Props in React</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Thu, 11 Nov 2021 11:11:55 +0000</pubDate>
      <link>https://dev.to/medaminefh/passing-components-as-props-in-react-36h8</link>
      <guid>https://dev.to/medaminefh/passing-components-as-props-in-react-36h8</guid>
      <description>&lt;p&gt;Programming is a lifelong learning journey, and most of that journey is asking Questions.&lt;/p&gt;

&lt;p&gt;And one of the Q i've asked while learning &lt;strong&gt;React&lt;/strong&gt; is &lt;code&gt;How To pass a component as Props?&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In this short Tutorial we will pass a simple &lt;strong&gt;React component&lt;/strong&gt; (Hello) to The App component as props&lt;/p&gt;

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

&lt;p&gt;Pass it as a Prop&lt;/p&gt;

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




&lt;p&gt;And This is How we use it in &lt;strong&gt;App&lt;/strong&gt; Component.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Components Must Start with an upper case letter.&lt;br&gt;
That's why we rename it Here&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbz8qnvr007v5yrr2v75.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbbz8qnvr007v5yrr2v75.png" alt="use component as a prop" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it Easy Peasy Lemon Squeezy 😎&lt;/p&gt;

&lt;p&gt;So this is a Simple Exp though, but when it comes to large Apps, you will definitely need to use this.&lt;/p&gt;

&lt;p&gt;Hope you like this Tuto &lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>3 Ways to Add JS to HTML</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Sun, 17 Oct 2021 14:22:03 +0000</pubDate>
      <link>https://dev.to/medaminefh/3-ways-to-add-js-to-html-2n9l</link>
      <guid>https://dev.to/medaminefh/3-ways-to-add-js-to-html-2n9l</guid>
      <description>&lt;h2&gt;
  
  
  1. Internal
&lt;/h2&gt;

&lt;p&gt;The 1st one is by placing the &lt;strong&gt;&lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;&lt;/strong&gt; tag in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; or in the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;if you placed in the body make sure it's before the closing &lt;strong&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/strong&gt; tag, so your scripts will run for all the elements in the body.&lt;/p&gt;
&lt;/blockquote&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%2Fsdldvyhhhxj1nzcly4jx.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%2Fsdldvyhhhxj1nzcly4jx.png" alt="Internal JS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;This way is not for daily use or for big projects, because the html file will be complicated more and more.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. External
&lt;/h2&gt;

&lt;p&gt;The 2nd is by creating a &lt;strong&gt;JS&lt;/strong&gt; file and link it inside your &lt;strong&gt;HTML&lt;/strong&gt; .&lt;/p&gt;

&lt;p&gt;In this example we created a Javascript file named &lt;code&gt;script.js&lt;/code&gt; and linked it using the &lt;code&gt;script&lt;/code&gt; tag. put the path to your JS file in the &lt;code&gt;src&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbx0risiy158x8zrtd9ts.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%2Fbx0risiy158x8zrtd9ts.png" alt="External JS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Inline
&lt;/h2&gt;

&lt;p&gt;The last way is the inline way. by adding an event listener inside any HTML element you want to run your scripts on.&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%2F1ozoscmo7369g8tunoob.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%2F1ozoscmo7369g8tunoob.png" alt="Inline Js"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;SO the above code runs when the user clicks on the body&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The common used way for daily programming is the &lt;strong&gt;External way&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>html</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>3 Ways to Add CSS to HTML</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Sun, 10 Oct 2021 06:53:36 +0000</pubDate>
      <link>https://dev.to/medaminefh/3-ways-to-add-css-to-html-1fad</link>
      <guid>https://dev.to/medaminefh/3-ways-to-add-css-to-html-1fad</guid>
      <description>&lt;h2&gt;
  
  
  1. Internal
&lt;/h2&gt;

&lt;p&gt;The 1st one is by placing the &lt;strong&gt;&lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt;&lt;/strong&gt; tag in the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; or in the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;if you placed in the body make sure it's after the opening &lt;strong&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/strong&gt; tag, so your styles will run for all the elements in the body.&lt;/p&gt;
&lt;/blockquote&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%2Fsuus7whvuoedqbt8q8jd.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%2Fsuus7whvuoedqbt8q8jd.png" alt="Internal Css"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;This way is not for daily use or for big projects, because the html file will be complicated more and more.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  2. External
&lt;/h2&gt;

&lt;p&gt;The 2nd is by creating a &lt;strong&gt;CSS&lt;/strong&gt; file and link it inside your &lt;strong&gt;HTML&lt;/strong&gt; .&lt;/p&gt;

&lt;p&gt;In this example we created a CSS file named &lt;code&gt;style.css&lt;/code&gt; and linked it using the &lt;code&gt;link&lt;/code&gt; tag. put the path to your css file in the &lt;code&gt;href&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2mq5ul60e7r0q09qdami.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%2F2mq5ul60e7r0q09qdami.png" alt="External Css"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Inline
&lt;/h2&gt;

&lt;p&gt;The last way is the inline way. by adding the &lt;code&gt;style&lt;/code&gt; property inside any HTML tag you want to style.&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%2Fi9i80lmwz5qulba9q91k.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%2Fi9i80lmwz5qulba9q91k.png" alt="Inline Css"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The common used way for daily programming is the &lt;strong&gt;External way&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Passing Data with React Router using Link</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Fri, 01 Oct 2021 12:50:52 +0000</pubDate>
      <link>https://dev.to/medaminefh/passing-data-with-react-router-using-link-1h39</link>
      <guid>https://dev.to/medaminefh/passing-data-with-react-router-using-link-1h39</guid>
      <description>&lt;p&gt;If you've used &lt;strong&gt;React Router&lt;/strong&gt; on many projects, definitely you've asked &lt;strong&gt;How i can pass some data or state to other components through a link tag?&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So 1st of all we'll discuss how we can pass data between components in React.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Passing props
&lt;/h3&gt;

&lt;p&gt;The 1st one is by passing some props from the parent component to the children components&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%2F396agklpv95vwyjdkssv.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%2F396agklpv95vwyjdkssv.png" alt="carbon (4)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8ngo93uqady6u4h0wrv2.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%2F8ngo93uqady6u4h0wrv2.png" alt="carbon (3)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Global State
&lt;/h3&gt;

&lt;p&gt;2nd one is by making a &lt;strong&gt;Global State&lt;/strong&gt; and make some data accessible by many components.&lt;/p&gt;

&lt;p&gt;You can manage Global State using two main paths:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://redux.js.org" rel="noopener noreferrer"&gt;Redux&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/context.html" rel="noopener noreferrer"&gt;React context&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Using React Router's Link
&lt;/h3&gt;

&lt;p&gt;3rd one is basically when you click on a link(to component), you passing data with that.&lt;/p&gt;

&lt;p&gt;Below we Have a simple React App with some routes&lt;br&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%2F180gizgnhw3vnvfjw5ti.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%2F180gizgnhw3vnvfjw5ti.png" alt="App"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We Have two routes Here the "&lt;code&gt;/&lt;/code&gt;"(Home) Route and the "&lt;code&gt;/profile&lt;/code&gt;"(Profile) route.&lt;/p&gt;

&lt;p&gt;So the 1st page we'll see if we run &lt;code&gt;yarn start&lt;/code&gt; is the &lt;strong&gt;Home&lt;/strong&gt; Page&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%2F5ljyvxzhlppovzmbx5mq.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%2F5ljyvxzhlppovzmbx5mq.png" alt="Home"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc6zdcjm60ay743rzq24o.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%2Fc6zdcjm60ay743rzq24o.png" alt="Screenshot from 2021-10-01 13-11-24"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if we go to the &lt;strong&gt;/profile&lt;/strong&gt; route &lt;br&gt;
we'll see the &lt;strong&gt;Profile&lt;/strong&gt; component  &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%2F0q14kjti8gkvgdbd4jau.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%2F0q14kjti8gkvgdbd4jau.png" alt="Profile"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7bsstxnvrw0ehv6ipthe.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%2F7bsstxnvrw0ehv6ipthe.png" alt="Screenshot from 2021-10-01 13-12-15"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;So as you can see we're using the &lt;code&gt;&amp;lt;Link&amp;gt;&lt;/code&gt; instead of the regular &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tag to prevent the refresh of the page.&lt;/p&gt;

&lt;h3&gt;
  
  
  So how we can send data for exemple to the &lt;strong&gt;Profile&lt;/strong&gt; component from the &lt;strong&gt;Home&lt;/strong&gt; component ?
&lt;/h3&gt;

&lt;p&gt;So the cool thing is we can pass an Object to the &lt;strong&gt;to&lt;/strong&gt; property in the &lt;strong&gt;&lt;code&gt;&amp;lt;Link&amp;gt;&lt;/code&gt;&lt;/strong&gt; and that object must contains a &lt;code&gt;pathname&lt;/code&gt; and optionally a &lt;code&gt;state&lt;/code&gt;, and we can pass the data through that state&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%2Fn85dxg1uafrgxi4y04cs.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%2Fn85dxg1uafrgxi4y04cs.png" alt="Screenshot from 2021-10-01 13-41-45"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and we can access that state in the &lt;strong&gt;Profile&lt;/strong&gt; component in the &lt;code&gt;props.location.state&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx9vc6730qsm35blkqxrq.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%2Fx9vc6730qsm35blkqxrq.png" alt="Screenshot from 2021-10-01 13-45-07"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7y9dfy4r4fhqva0i9vhi.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%2F7y9dfy4r4fhqva0i9vhi.png" alt="Screenshot from 2021-10-01 13-46-47"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;for more Info check this &lt;a href="https://reactrouter.com/web/api/Link" rel="noopener noreferrer"&gt;React Router Link&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Protect Your Routes in React</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Tue, 28 Sep 2021 18:09:26 +0000</pubDate>
      <link>https://dev.to/medaminefh/protect-your-components-with-react-router-4hf7</link>
      <guid>https://dev.to/medaminefh/protect-your-components-with-react-router-4hf7</guid>
      <description>&lt;p&gt;If you're using &lt;strong&gt;react router&lt;/strong&gt; in your App, then you probably wanted to protect some routes from specific users, or to Redirect some users to their own page or component.&lt;/p&gt;

&lt;h2&gt;
  
  
  so what to do ?
&lt;/h2&gt;

&lt;p&gt;In this blog we'll see How to handle that with some simple checks&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RREhlun1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://i.gifer.com/7efs.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RREhlun1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://i.gifer.com/7efs.gif" alt="checks" width="480" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So at the beginning this is how our App looks like&lt;/p&gt;

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

&lt;p&gt;At this point every user can access those two components (Admin, Home)&lt;/p&gt;

&lt;p&gt;But that's not what i want, I want just the &lt;strong&gt;admin&lt;/strong&gt; to have access to the "&lt;code&gt;/admin&lt;/code&gt;" route.&lt;/p&gt;

&lt;p&gt;And those who don't have access to that route, I need to redirect them to the &lt;strong&gt;Home&lt;/strong&gt; Page ("&lt;code&gt;/&lt;/code&gt;" route)&lt;/p&gt;

&lt;p&gt;So the 1st Step is to create the &lt;strong&gt;ProtectedRoute&lt;/strong&gt; Component.&lt;/p&gt;

&lt;p&gt;You can create it in the same file, but for a cleaner code we'll create it on a new file&lt;/p&gt;

&lt;h3&gt;
  
  
  1- Create a file and name it to what you want. I'll name it &lt;code&gt;protectedRoute.js&lt;/code&gt;.
&lt;/h3&gt;



&lt;h3&gt;
  
  
  2- Paste this code in that file
&lt;/h3&gt;

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

&lt;p&gt;So basically we check if there is a &lt;strong&gt;token&lt;/strong&gt; stored in our &lt;strong&gt;LocalStorage&lt;/strong&gt; or not.&lt;/p&gt;

&lt;p&gt;If The check is &lt;strong&gt;Truthy&lt;/strong&gt; then he Have access to that route.&lt;br&gt;
 If Not, He will be Redirected to the Home Page (thanks to the &lt;code&gt;&amp;lt;Redirect /&amp;gt;&lt;/code&gt; Component).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You need to change that check to suit your case.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Don't forget to &lt;strong&gt;export&lt;/strong&gt; your Component.&lt;/p&gt;

&lt;h3&gt;
  
  
  3- Finally we'll use that ProtectedRoute in our &lt;strong&gt;App&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Import The &lt;em&gt;ProtectedRoute&lt;/em&gt; Component from where you created it&lt;br&gt;
you can name it what you want if you export it with the &lt;strong&gt;default&lt;/strong&gt;&lt;/p&gt;

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

&lt;p&gt;So here we need to change The &lt;br&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;Route exact path="/admin" component={Admin}  /&amp;gt;&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;with&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;ProtectedRoute exact path="/admin" component={Admin}  /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  And that's it 🎉, Go Try it out.
&lt;/h3&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>programming</category>
      <category>security</category>
    </item>
    <item>
      <title>How To Host your static website with Github</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Sat, 18 Sep 2021 10:34:45 +0000</pubDate>
      <link>https://dev.to/medaminefh/how-to-host-your-static-website-with-github-85i</link>
      <guid>https://dev.to/medaminefh/how-to-host-your-static-website-with-github-85i</guid>
      <description>&lt;p&gt;You Have an Html, Css and Js files in your computer and you want to show it to your colleagues ?&lt;br&gt;
Github Has an amazing static site hosting service that takes HTML, CSS, and JavaScript files straight from your repository&lt;/p&gt;

&lt;p&gt;Lets go to the steps:&lt;/p&gt;

&lt;h3&gt;
  
  
  1- Create a repository with your username followed by &lt;code&gt;.github.io&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;in my case my username is &lt;code&gt;BegDevv&lt;/code&gt;, so the repo name would be &lt;code&gt;BegDevv.github.io&lt;/code&gt; :&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1v06qy17jxfw4f5usyz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo1v06qy17jxfw4f5usyz.png" alt="Create a Repo" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2- Upload your static files into that repository (Html/Css/Js)
&lt;/h3&gt;

&lt;p&gt;you're done 💯 ❤ github will host your files in that repo automatically Go to &lt;code&gt;https://{yourusername}.github.io&lt;/code&gt; (change yourusername with yours)&lt;/p&gt;

</description>
      <category>github</category>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>React Router with Github Pages 💎</title>
      <dc:creator>Mohamed Amine Fh</dc:creator>
      <pubDate>Sat, 18 Sep 2021 08:48:44 +0000</pubDate>
      <link>https://dev.to/medaminefh/react-router-with-github-pages-40gj</link>
      <guid>https://dev.to/medaminefh/react-router-with-github-pages-40gj</guid>
      <description>&lt;p&gt;If you have tried to deploy a &lt;strong&gt;React App&lt;/strong&gt; with react-router-dom to github pages, probably you'll hate yourself because it won't work as you expected 😔.&lt;/p&gt;

&lt;h3&gt;
  
  
  So what the heck is going on ? why is this happening?
&lt;/h3&gt;

&lt;p&gt;So if you don't know &lt;strong&gt;gh-pages&lt;/strong&gt; deploy your &lt;strong&gt;React&lt;/strong&gt; App&lt;br&gt;
to this url &lt;code&gt;http://{username}.github.io/{repo-name}&lt;/code&gt;&lt;br&gt;
and in your App the "&lt;strong&gt;/&lt;/strong&gt;" route means this url &lt;code&gt;http://{username}.github.io/&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  So one solution for this
&lt;/h3&gt;

&lt;p&gt;is to replace the &lt;strong&gt;BrowserRouter&lt;/strong&gt; with &lt;strong&gt;HashRouter&lt;/strong&gt;&lt;br&gt;
so instead of this &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f23awy9tzhrkkhc7pga.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f23awy9tzhrkkhc7pga.png" alt="BrowserRouter" width="635" height="97"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;do this&lt;/p&gt;

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

&lt;p&gt;Now deploy again your changes with &lt;br&gt;
&lt;code&gt;npm run deploy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Thats it&lt;/p&gt;

</description>
      <category>react</category>
      <category>github</category>
    </item>
  </channel>
</rss>
