<?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: Victor de la Fouchardière</title>
    <description>The latest articles on DEV Community by Victor de la Fouchardière (@viclafouch).</description>
    <link>https://dev.to/viclafouch</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%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg</url>
      <title>DEV Community: Victor de la Fouchardière</title>
      <link>https://dev.to/viclafouch</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/viclafouch"/>
    <language>en</language>
    <item>
      <title>👑 Create a secure Chat Application with React Hooks, Firebase and Seald 🔐</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Mon, 31 Aug 2020 21:03:11 +0000</pubDate>
      <link>https://dev.to/viclafouch/create-a-secure-chat-application-with-react-hooks-firebase-and-seald-2bc1</link>
      <guid>https://dev.to/viclafouch/create-a-secure-chat-application-with-react-hooks-firebase-and-seald-2bc1</guid>
      <description>&lt;p&gt;Hello guys ! 👋&lt;/p&gt;

&lt;p&gt;Today, let's discover a small chat application developed with &lt;strong&gt;React Hooks&lt;/strong&gt;, &lt;strong&gt;Firebase&lt;/strong&gt; and a new package named &lt;strong&gt;Seald&lt;/strong&gt;! 🔥&lt;/p&gt;

&lt;p&gt;The goal of this article is to introduce you the Seald SDK and how this little package can be very effective in terms of security for your apps!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb086ptjw4hn4xccn6iog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb086ptjw4hn4xccn6iog.png" alt="cybersecurity meme" width="613" height="344"&gt;&lt;/a&gt;&lt;/p&gt;
Created with meme-studio.io



&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/End-to-end_encryption" rel="noopener noreferrer"&gt;&lt;strong&gt;End-to-end encryption&lt;/strong&gt;&lt;/a&gt; of unstructured data can be complex and expensive to redevelop, essential to protect the confidential data your applications handle. With &lt;a href="https://www.seald.io/products/integrations" rel="noopener noreferrer"&gt;Seald SDK&lt;/a&gt;, we perform end-to-end encryption on data stored, produced or received by your applications. &lt;/p&gt;

&lt;p&gt;Let's take an example with &lt;strong&gt;a chat application&lt;/strong&gt; ! 💪&lt;/p&gt;

&lt;h2&gt;
  
  
  Structure of our chat app 🧰
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm8dwn3r63zpczg413nsz.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fm8dwn3r63zpczg413nsz.gif" alt="Seald chat demo" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;
React + Firebase + Seald



&lt;p&gt;Above is &lt;strong&gt;a demo of our chat app&lt;/strong&gt; in React, with an end-to-end encryption system, including several features: &lt;/p&gt;

&lt;p&gt;🟢 Create a room&lt;br&gt;
🟢 Add/Remove users from a room&lt;br&gt;
🟢 Modify a room&lt;br&gt;
🟢 Registration / Login &lt;br&gt;
🟢 User status&lt;br&gt;
🟢 Encrypting and decrypting a message&lt;/p&gt;
&lt;h3&gt;
  
  
  The &lt;strong&gt;main tools used are&lt;/strong&gt;:
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://firebase.google.com" rel="noopener noreferrer"&gt;Firebase&lt;/a&gt;, a ready-to-use framework which allows us to create a persistent authentication system, save our encrypted messages in a database and receive them instantly when a user posts a new message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://reactjs.org" rel="noopener noreferrer"&gt;React&lt;/a&gt; which will be our frontend library to perform and design simple views for each state in our application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.seald.io" rel="noopener noreferrer"&gt;Seald&lt;/a&gt;, the turnkey library we will use to bring end-2-end encryption 🔐 to the chat.&lt;/p&gt;
&lt;h2&gt;
  
  
  Auth system 👨‍💻
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9oi0vzf263x0v6ew29b2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9oi0vzf263x0v6ew29b2.png" alt="React Router" width="800" height="684"&gt;&lt;/a&gt;&lt;/p&gt;
Router with 3 routes



&lt;p&gt;Only 3 routes for our chat application with authentication. &lt;strong&gt;Registration&lt;/strong&gt;, &lt;strong&gt;login&lt;/strong&gt; and &lt;strong&gt;room management&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;We define if the routes are allowed for authenticated users or not.&lt;/p&gt;
&lt;h3&gt;
  
  
  Password derivation 🔏
&lt;/h3&gt;

&lt;p&gt;Normally, we would send Firebase the password in cleartext, and then Firebase would derive it with a secure function such as &lt;strong&gt;SCRYPT&lt;/strong&gt; in order to avoid having it in the database.&lt;/p&gt;

&lt;p&gt;In our case, we want to prevent Firebase from ever being able to read the password, even if it’s not stored, because we’re going to use it for protecting &lt;strong&gt;the Seald identity end-2-end&lt;/strong&gt; (even from Firebase).&lt;/p&gt;

&lt;p&gt;In order to do that, we just do the same operation Firebase does, but &lt;em&gt;before&lt;/em&gt; giving it to Firebase : we derive the password with a secure function (&lt;strong&gt;SCRYPT&lt;/strong&gt;) and then use it as a password. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1zkw3ak5bisgqbhnii5t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1zkw3ak5bisgqbhnii5t.png" alt="Password derivation" width="800" height="296"&gt;&lt;/a&gt;&lt;/p&gt;
Password derivation before giving it to Firebase


&lt;h3&gt;
  
  
  Sign up 👤
&lt;/h3&gt;

&lt;p&gt;In order to create a user in this application, a simple form containing 3 fields is enough: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ff9habf4cqavz2gv6lwj5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ff9habf4cqavz2gv6lwj5.png" alt="Sign up Seald demo" width="800" height="526"&gt;&lt;/a&gt;&lt;/p&gt;
Sign up form



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fslcc8wehs9c5e7eaqhaa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fslcc8wehs9c5e7eaqhaa.png" alt="Sign up code" width="800" height="367"&gt;&lt;/a&gt;Sign up code&lt;/p&gt;

&lt;p&gt;Nothing very complicated in the code. We ask Firebase to create an authentication via an email and a password provided by the user.&lt;/p&gt;

&lt;p&gt;And also add some informations about the user, like the name and a photo URL.&lt;/p&gt;

&lt;p&gt;Then, we add the Seald application layer to create our future &lt;br&gt;
encrypted messages.&lt;/p&gt;
&lt;h3&gt;
  
  
  Sign in 👤
&lt;/h3&gt;

&lt;p&gt;Then, the login. A classic form (&lt;strong&gt;email&lt;/strong&gt; / &lt;strong&gt;password&lt;/strong&gt;) in order to access the rooms and be able to chat with other users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fehihqcixbuo7sisnox0d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fehihqcixbuo7sisnox0d.png" alt="Sign in Seald demo" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;
Sign in form



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fn8lv5j3hjv5jy0u8rvxr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fn8lv5j3hjv5jy0u8rvxr.png" alt="Sign in Seald code" width="800" height="349"&gt;&lt;/a&gt;&lt;/p&gt;
Sign in code



&lt;p&gt;Same as on the registration. We retrieve the &lt;strong&gt;Firebase authentication&lt;/strong&gt; of the user and his &lt;strong&gt;Seald account&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Rooms 👨‍👩‍👦‍👦
&lt;/h2&gt;

&lt;p&gt;That's where the interesting part comes from.&lt;/p&gt;

&lt;p&gt;On this application, it is possible to &lt;strong&gt;chat in 1 to 1&lt;/strong&gt; with an another user, but also to &lt;strong&gt;chat with a group of users&lt;/strong&gt; in a custom room. &lt;/p&gt;
&lt;h3&gt;
  
  
  Create a room 🧸
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgeo99wm8xk4vczrnxx53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgeo99wm8xk4vczrnxx53.png" alt="Add room Seald demo" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;
Create a room



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbzmfah9ud6e4rk75ld1n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbzmfah9ud6e4rk75ld1n.png" alt="Add room Seald code" width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let's detail this code together: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First, we send the form data to &lt;a href="//firebase.google.com"&gt;Firebase&lt;/a&gt;. The name of the room and the selected users are required.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Then we create an encrypted session using the &lt;a href="https://www.seald.io" rel="noopener noreferrer"&gt;Seald SDK&lt;/a&gt;. This will allow to &lt;strong&gt;encrypt&lt;/strong&gt; and &lt;strong&gt;decrypt&lt;/strong&gt; a message for this room.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;And finally, we want to send the first encrypted message to welcome the users of this room.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjvhxvhc8vtqj257fy081.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjvhxvhc8vtqj257fy081.png" alt="Demo hello" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
Our first room!


 
&lt;h3&gt;
  
  
  Send encrypted messages 🔏
&lt;/h3&gt;

&lt;p&gt;Now, let's chat ! But, remember, we want an &lt;strong&gt;End-To-End encryption&lt;/strong&gt; for the messages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjj30v8jhlb94lkps0t37.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjj30v8jhlb94lkps0t37.png" alt="Seald sdk" width="800" height="635"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before each created message, we need to check if we have an authenticated Seald session. If not, create that session with the SDK 🔒.&lt;/p&gt;

&lt;p&gt;Then, the session allows us to encrypt a string, which is our message. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Alice&lt;/strong&gt; 👩 sends a message to &lt;strong&gt;Bob&lt;/strong&gt; 👨&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello my friend&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We call the method &lt;code&gt;encrypt&lt;/code&gt; for our message above:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fds6d1ob6ixnnq9fuw8rb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fds6d1ob6ixnnq9fuw8rb.png" alt="Seald encrypt message" width="800" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The message will become&lt;/strong&gt;&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;sessionId&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;NazDAYyuRw2lDKS0VaianA&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;data&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;8RwaOppCD3uIJVFv2LoP3XGXpomj0xsMv4qmMVy30Vdqor2w0+DVCXu3j13PEyN2KfJm6SiSrWDRMDziiiOUjQ==&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs29hph61kqp49rc7pa60.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fs29hph61kqp49rc7pa60.png" alt="Encrypted message Seald" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;
🔴 Before decrypting messages



&lt;p&gt;Now, Bob 👨(and others users of the room) need to &lt;strong&gt;decrypt the message of Alice 👩&lt;/strong&gt;. How can we do that ? &lt;/p&gt;
&lt;h3&gt;
  
  
  Decrypted messages 🔐
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqqtd6xfqg7rarhl1e8rb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqqtd6xfqg7rarhl1e8rb.png" alt="Seald sdk code decrypt" width="800" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that we know how to send an encrypted message, let's see how to retrieve a message instantly and decrypt it for other users.&lt;/p&gt;

&lt;p&gt;We use the &lt;code&gt;value&lt;/code&gt; event to read our messages, as they existed at the time of the event. &lt;a href="https://firebase.google.com/docs/database/web/read-and-write#listen_for_value_events" rel="noopener noreferrer"&gt;This method&lt;/a&gt; is triggered once when the listener is attached and again every time the data, including children, changes.&lt;/p&gt;

&lt;p&gt;Read more about &lt;a href="https://firebase.google.com/docs/database/web/read-and-write" rel="noopener noreferrer"&gt;reading and writing Data with Firebase&lt;/a&gt; 📂&lt;/p&gt;

&lt;p&gt;We retrieve our message list every time a message is added. So an encrypted message is displayed, but now we need to be able to decrypt it:  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bob 👨 actually sees&lt;/strong&gt;:&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;sessionId&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;NazDAYyuRw2lDKS0VaianA&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;data&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;8RwaOppCD3uIJVFv2LoP3XGXpomj0xsMv4qmMVy30Vdqor2w0+DVCXu3j13PEyN2KfJm6SiSrWDRMDziiiOUjQ==&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We call the method &lt;code&gt;decrypt&lt;/code&gt; for our encrypted message above:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi5cex96s3ebfzw7j8xsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fi5cex96s3ebfzw7j8xsh.png" alt="Decrypt sdk Seald" width="800" height="135"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bob 👨 will now see&lt;/strong&gt;:&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello my friend&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvsoy80p00l9q0pcop4to.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvsoy80p00l9q0pcop4to.png" alt="Chat demo decrypted Seald" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;
🟢 After decrypting messages



&lt;p&gt;We now have a real time chat with an end-to-end encryption system 💪&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: To use the Seald SDK, go to &lt;a href="https://www.seald.io" rel="noopener noreferrer"&gt;seald.io&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Voilà&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;

&lt;p&gt;If you enjoyed this article you can follow me on &lt;a href="https://twitter.com/TrustedSheriff" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or here on &lt;a href="https://dev.to/viclafouch"&gt;dev.to&lt;/a&gt; where I regularly post bite size tips relating to HTML, CSS and JavaScript.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/promise-allsettled-vs-promise-all-in-javascript-4mle" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🤝 Promise.allSettled() VS Promise.all() in JavaScript 🍭&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Aug 16 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#node&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;




&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/github-profile-the-right-way-to-show-your-latest-dev-articles-bonus-398m" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;📦 GitHub Profile: The RIGHT Way to Show your latest DEV articles + BONUS 🎁&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Aug 5 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#github&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#markdown&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>react</category>
      <category>javascript</category>
      <category>showdev</category>
      <category>firebase</category>
    </item>
    <item>
      <title>🍿 Publish your own ESLint / Prettier config for React Projects on NPM 📦</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Mon, 24 Aug 2020 09:23:08 +0000</pubDate>
      <link>https://dev.to/viclafouch/publish-your-own-eslint-prettier-config-for-react-projects-on-npm-g3p</link>
      <guid>https://dev.to/viclafouch/publish-your-own-eslint-prettier-config-for-react-projects-on-npm-g3p</guid>
      <description>&lt;p&gt;Hello guys! 👨‍💻&lt;/p&gt;

&lt;p&gt;You probably know &lt;a href="https://eslint.org" rel="noopener noreferrer"&gt;ESLint&lt;/a&gt; and &lt;a href="https://prettier.io" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt;, but do you have &lt;strong&gt;your own configuration&lt;/strong&gt; for your &lt;strong&gt;React&lt;/strong&gt; projects? 💪&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvrn2j6ewerdkpbuyrmz8.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvrn2j6ewerdkpbuyrmz8.gif" alt="VSCode Eslint" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;
VS Code + Prettier + ESLint



&lt;h2&gt;
  
  
  A quick reminder 🧠
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://eslint.org" rel="noopener noreferrer"&gt;ESLint&lt;/a&gt; is a static code analysis tool for identifying problematic patterns found in JavaScript code. You can configure ESLint to fix all the problems in a file when this file is saved.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://prettier.io" rel="noopener noreferrer"&gt;Prettier&lt;/a&gt; is an opinionated code formatter that supports a lot of different programming languages, like: JavaScript; JSON; JSX; CSS; Markdown. Prettier will make your code look good without you ever having to dabble in the formatting. I estimate the time saved thanks to Prettier at about 1 hour a day.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this article, we will see &lt;strong&gt;how to create your own ESLint + Prettier configuration&lt;/strong&gt; in order to reuse it in your own &lt;strong&gt;React apps&lt;/strong&gt; ! 🔥 &lt;/p&gt;

&lt;p&gt;Example : &lt;a href="https://github.com/viclafouch/eslint-config-viclafouch" rel="noopener noreferrer"&gt;https://github.com/viclafouch/eslint-config-viclafouch&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Create the repository ✏️
&lt;/h2&gt;

&lt;p&gt;First of all, I advise you to &lt;a href="https://github.com/new" rel="noopener noreferrer"&gt;create a repository&lt;/a&gt; in order to save your configuration and to modify your rules when you want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://eslint.org/docs/developer-guide/shareable-configs" rel="noopener noreferrer"&gt;By convention&lt;/a&gt;, the module name begins with &lt;strong&gt;eslint-config-&lt;/strong&gt;, such as &lt;strong&gt;eslint-config-foo&lt;/strong&gt;. For example &lt;strong&gt;eslint-config-viclafouch&lt;/strong&gt; (it's my username) or &lt;strong&gt;eslint-config-react&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fg1grr443njm96ui4pwtm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fg1grr443njm96ui4pwtm.png" alt="GitHub create" width="800" height="468"&gt;&lt;/a&gt;&lt;/p&gt;
Create the repository



&lt;p&gt;Then, &lt;strong&gt;clone the new repository&lt;/strong&gt; into your local disk.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/$USERNAME/eslint-config-$USERNAME.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  2. Create an ESLint configuration 🧰
&lt;/h2&gt;

&lt;p&gt;Let's start our configuration for our React projects. &lt;/p&gt;

&lt;p&gt;First, &lt;strong&gt;add your ESLint dependencies&lt;/strong&gt; 💪. The packages below will change according of what you want.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;babel-eslint&lt;/li&gt;
&lt;li&gt;eslint&lt;/li&gt;
&lt;li&gt;prettier&lt;/li&gt;
&lt;li&gt;eslint-config-prettier&lt;/li&gt;
&lt;li&gt;eslint-plugin-prettier&lt;/li&gt;
&lt;li&gt;eslint-plugin-react&lt;/li&gt;
&lt;li&gt;eslint-plugin-react-hooks&lt;/li&gt;
&lt;li&gt;eslint-plugin-jsx-a11y&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just copy/past 🗒 the following command:&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 -D eslint prettier eslint-config-prettier eslint-plugin-prettier eslint-plugin-react eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-jsx-a11y babel-eslint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;ℹ️ The documentation mentions that if your shareable config depends on a plugin, you &lt;strong&gt;should also specify it as a peerDependency&lt;/strong&gt; (plugins will be loaded relative to the end user's project, so the end user is required to install the plugins they need).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Your &lt;code&gt;package.json&lt;/code&gt; should now look like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnzcg5vij14h7gpezhc38.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnzcg5vij14h7gpezhc38.png" alt="package json" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  ESLint config 🔹
&lt;/h3&gt;

&lt;p&gt;Next, let's create a &lt;code&gt;.eslintrc.js&lt;/code&gt; file and add the ESLint plugins that apply certain rules (for React, React Hooks, ...) to our configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc7818vaelapvohs3h7aa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fc7818vaelapvohs3h7aa.png" alt="Eslint react config" width="800" height="642"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Prettier config 🔸
&lt;/h3&gt;

&lt;p&gt;Then, to custom your Prettier configuration, just add an object representing &lt;a href="https://prettier.io/docs/en/options.html" rel="noopener noreferrer"&gt;options&lt;/a&gt; to your custom &lt;code&gt;rules&lt;/code&gt;. These options will be passed into prettier.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmdk7b1eplrf6vvpcfvjq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmdk7b1eplrf6vvpcfvjq.png" alt="Prettier config" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;
Example of my Prettier config



&lt;p&gt;You can find a simple example of my configuration here: &lt;a href="https://github.com/viclafouch/eslint-config-viclafouch" rel="noopener noreferrer"&gt;https://github.com/viclafouch/eslint-config-viclafouch&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Export your config 💡
&lt;/h2&gt;

&lt;p&gt;The next step is to create an &lt;code&gt;index.js&lt;/code&gt; file to export your configuration to your React applications.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4y6l3efvs4pc9r1eejhm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4y6l3efvs4pc9r1eejhm.png" alt="export eslint" width="800" height="201"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Publish your config on &lt;strong&gt;NPM&lt;/strong&gt; 🚀
&lt;/h2&gt;

&lt;p&gt;Before publishing your configuration, make sure to give good metadata like the &lt;em&gt;name&lt;/em&gt;, &lt;em&gt;keywords&lt;/em&gt;, &lt;em&gt;description&lt;/em&gt; ...&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3bwbr6n3efsu60m8tf98.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3bwbr6n3efsu60m8tf98.png" alt="package.json metadata" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;
Example with my own config



&lt;p&gt;If everything looks fine, you can publish to the NPM registry 🥳&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm publish
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Import your config into your React Apps 🎉
&lt;/h2&gt;

&lt;p&gt;First, we need to install everything needed by the config:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example with my own config&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;npx install-peerdeps --dev @viclafouch/eslint-config-viclafouch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then, create a &lt;code&gt;.eslintrc.js&lt;/code&gt; file in the root of your project's directory. My &lt;code&gt;.eslintrc.js&lt;/code&gt; file looks like this (be sure to extend with your own configuration): &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fabsgj7zau3lokmjts0r1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fabsgj7zau3lokmjts0r1.png" alt="viclafouch eslint" width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;
Example with my own config


 

&lt;p&gt;Finally, you can add two &lt;strong&gt;scripts&lt;/strong&gt; to your &lt;strong&gt;package.json&lt;/strong&gt; to lint and/or fix your code:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzuie8zkjj0u8uchqlmqd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzuie8zkjj0u8uchqlmqd.png" alt="Lint/fix your code" width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you have your own config available on &lt;strong&gt;NPM&lt;/strong&gt;, ready to be used in your React projects, and editable at any time!&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/viclafouch" rel="noopener noreferrer"&gt;
        viclafouch
      &lt;/a&gt; / &lt;a href="https://github.com/viclafouch/eslint-config-viclafouch" rel="noopener noreferrer"&gt;
        eslint-config-viclafouch
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🛠 These are my settings for TypeScript / ESLint / Prettier in a project
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Voilàà&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;

&lt;p&gt;If you enjoyed this article you can follow me on &lt;a href="https://twitter.com/TrustedSheriff" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or here on &lt;a href="https://dev.to/viclafouch"&gt;dev.to&lt;/a&gt; where I regularly post bite size tips relating to HTML, CSS and JavaScript.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/promise-allsettled-vs-promise-all-in-javascript-4mle" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🤝 Promise.allSettled() VS Promise.all() in JavaScript 🍭&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Aug 16 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#node&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/github-profile-the-right-way-to-show-your-latest-dev-articles-bonus-398m" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;📦 GitHub Profile: The RIGHT Way to Show your latest DEV articles + BONUS 🎁&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Aug 5 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#github&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#markdown&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>react</category>
      <category>npm</category>
      <category>eslint</category>
    </item>
    <item>
      <title>🤝 Promise.allSettled() VS Promise.all() in JavaScript 🍭</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Sun, 16 Aug 2020 17:17:18 +0000</pubDate>
      <link>https://dev.to/viclafouch/promise-allsettled-vs-promise-all-in-javascript-4mle</link>
      <guid>https://dev.to/viclafouch/promise-allsettled-vs-promise-all-in-javascript-4mle</guid>
      <description>&lt;p&gt;Hello ! 🧑‍🌾&lt;/p&gt;

&lt;p&gt;Promises are available since ES2015 to simplify the handling of asynchronous operations. &lt;/p&gt;

&lt;p&gt;Let's discover 2 Promises and their differences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled" rel="noopener noreferrer"&gt;Promise.allSettled(iterable)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all" rel="noopener noreferrer"&gt;Promise.all(iterable)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both of them take an &lt;code&gt;iterable&lt;/code&gt; and return an &lt;code&gt;array&lt;/code&gt; containing the fulfilled Promises.&lt;/p&gt;

&lt;p&gt;❓ So, &lt;strong&gt;what is the difference between them&lt;/strong&gt;?&lt;/p&gt;

&lt;h2&gt;
  
  
  Promise.all() 🧠
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Promise.&lt;code&gt;all()&lt;/code&gt;&lt;/strong&gt; method takes an iterable of promises as an input, and returns a single Promise that resolves to an array of the results of the input promises. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Floq7cd72u055wl92yq2u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Floq7cd72u055wl92yq2u.png" alt="Promise all" width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;
All resolved



&lt;p&gt;As you can see, we are passing an array to Promise.all. And when all three promises get resolved, Promise.all resolves and the output is consoled.&lt;/p&gt;

&lt;p&gt;Now, let's see &lt;strong&gt;if one promise is not resolved&lt;/strong&gt;, and so, if this one is reject. What was the output ? 🛑&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgcpmjldpgbfc8xgqgh10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fgcpmjldpgbfc8xgqgh10.png" alt="Promise all failed" width="800" height="369"&gt;&lt;/a&gt;&lt;/p&gt;
1 failed



&lt;p&gt;&lt;code&gt;Promise.all&lt;/code&gt; is rejected if at least &lt;strong&gt;one of the elements are rejected&lt;/strong&gt;. For example, we pass 2 promises that resolve and one promise that rejects immediately, then &lt;code&gt;Promise.all&lt;/code&gt; will reject immediately. &lt;/p&gt;

&lt;h2&gt;
  
  
  Promise.allSettled() 🦷
&lt;/h2&gt;

&lt;p&gt;Since ES2020 you can use &lt;code&gt;Promise.allSettled&lt;/code&gt;. It returns a promise that &lt;strong&gt;always resolves&lt;/strong&gt; after all of the given promises have either fulfilled or rejected, with an array of objects that each describes the outcome of each promise.&lt;/p&gt;

&lt;p&gt;For each outcome object, a &lt;em&gt;&lt;code&gt;status&lt;/code&gt;&lt;/em&gt; string is present :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;fulfilled&lt;/code&gt; ✅&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rejected&lt;/code&gt; ❌ &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The value (or reason) reflects what value each promise was fulfilled (or rejected) with.&lt;/p&gt;

&lt;p&gt;Have a close look at following properties (&lt;em&gt;&lt;code&gt;status&lt;/code&gt;&lt;/em&gt;, &lt;em&gt;&lt;code&gt;value&lt;/code&gt;&lt;/em&gt;, &lt;em&gt;&lt;code&gt;reason&lt;/code&gt;&lt;/em&gt;) of resulting array.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Differences 👬
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Promise.all&lt;/strong&gt; will reject as soon as one of the Promises in the array rejects.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Promise.allSettled&lt;/strong&gt; will never reject, it will resolve once all Promises in the array have either rejected or resolved.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Supported Browsers 🚸
&lt;/h3&gt;

&lt;p&gt;The browsers supported by JavaScript &lt;strong&gt;Promise.allSettled()&lt;/strong&gt; and &lt;strong&gt;Promise.all()&lt;/strong&gt;  methods are listed below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Google Chrome&lt;/li&gt;
&lt;li&gt;Microsoft Edge&lt;/li&gt;
&lt;li&gt;Mozilla Firefox&lt;/li&gt;
&lt;li&gt;Apple Safari&lt;/li&gt;
&lt;li&gt;Opera&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;

&lt;p&gt;If you enjoyed this article you can follow me on &lt;a href="https://twitter.com/TrustedSheriff" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or here on &lt;a href="https://dev.to/viclafouch"&gt;dev.to&lt;/a&gt; where I regularly post bite size tips relating to HTML, CSS and JavaScript.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/github-profile-the-right-way-to-show-your-latest-dev-articles-bonus-398m" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;📦 GitHub Profile: The RIGHT Way to Show your latest DEV articles + BONUS 🎁&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Aug 5 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#github&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#markdown&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/cancel-properly-http-requests-in-react-hooks-and-avoid-memory-leaks-pd7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🍦 Cancel Properly HTTP Requests in React Hooks and avoid Memory Leaks 🚨&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 29 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>node</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Share your Portfolio here 📣</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Mon, 10 Aug 2020 16:38:30 +0000</pubDate>
      <link>https://dev.to/viclafouch/share-your-portfolio-here-3hgg</link>
      <guid>https://dev.to/viclafouch/share-your-portfolio-here-3hgg</guid>
      <description>&lt;p&gt;Hello there ! 👋&lt;/p&gt;

&lt;p&gt;I would like to know more about this community ! 🤗&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F38qkn3ty211jt6tlgklr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F38qkn3ty211jt6tlgklr.png" alt="Porfolio Meme" width="500" height="366"&gt;&lt;/a&gt;&lt;/p&gt;
Created with meme-studio.io



&lt;p&gt;I have &lt;strong&gt;1 question&lt;/strong&gt; for you : &lt;/p&gt;

&lt;h2&gt;
  
  
  What is your portfolio URL ? And how is your portfolio site built (&lt;code&gt;React.js&lt;/code&gt;? &lt;code&gt;Vanilla&lt;/code&gt;? &lt;code&gt;ROR&lt;/code&gt;? ...)
&lt;/h2&gt;




&lt;blockquote&gt;
&lt;p&gt;This array below will be updated every hours !&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Tech&lt;/th&gt;
&lt;th&gt;URL&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/viclafouch"&gt;@viclafouch&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Next.js on Vercel&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.victor-de-la-fouchardiere.fr" rel="noopener noreferrer"&gt;https://www.victor-de-la-fouchardiere.fr&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/gradam"&gt;@gradam&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gatsby on GH pages&lt;/td&gt;
&lt;td&gt;&lt;a href="https://semik.dev" rel="noopener noreferrer"&gt;https://semik.dev&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/michaelgee22"&gt;@michaelgee22&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Next.js on Vercel&lt;/td&gt;
&lt;td&gt;&lt;a href="https://michaelgee.com" rel="noopener noreferrer"&gt;https://michaelgee.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/giselamd"&gt;@giselamd&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gatsby with Netlify CMS&lt;/td&gt;
&lt;td&gt;&lt;a href="http://giselamirandadifini.com" rel="noopener noreferrer"&gt;http://giselamirandadifini.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/ehsan"&gt;@ehsan&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Static Vanilla JS on GH pages&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.ehsanazizi.me" rel="noopener noreferrer"&gt;https://www.ehsanazizi.me&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/aliahsan07"&gt;@aliahsan07&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gatsby on Netlify&lt;/td&gt;
&lt;td&gt;&lt;a href="https://aliahsan.tech" rel="noopener noreferrer"&gt;https://aliahsan.tech&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/imshravan"&gt;@imshravan&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Static Vanilla JS&lt;/td&gt;
&lt;td&gt;&lt;a href="http://www.ohmyscript.com" rel="noopener noreferrer"&gt;http://www.ohmyscript.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/daviddalbusco"&gt;@daviddalbusco&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gatsby, GitHub Actions and Firebase hosting&lt;/td&gt;
&lt;td&gt;&lt;a href="https://daviddalbusco.com" rel="noopener noreferrer"&gt;https://daviddalbusco.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/ixartz"&gt;@ixartz&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Eleventy.js on Vercel&lt;/td&gt;
&lt;td&gt;&lt;a href="https://creativedesignsguru.com" rel="noopener noreferrer"&gt;https://creativedesignsguru.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/hougesen"&gt;@hougesen&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Static Vanilla JS&lt;/td&gt;
&lt;td&gt;&lt;a href="https://mhouge.dk" rel="noopener noreferrer"&gt;https://mhouge.dk&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/ryansmith"&gt;@ryansmith&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gatsby&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ryansmith.tech" rel="noopener noreferrer"&gt;https://ryansmith.tech&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/djaidri_oussama"&gt;@djaidri_oussama&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gridsome, Tailwindcss on Netlify&lt;/td&gt;
&lt;td&gt;&lt;a href="https://xenodochial-yonath-b7c6a8.netlify.app" rel="noopener noreferrer"&gt;https://xenodochial-yonath-b7c6a8.netlify.app&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/eudds"&gt;@eudds&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Vanilla JS&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ericudlis.com" rel="noopener noreferrer"&gt;https://ericudlis.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/pedropcruz"&gt;@pedropcruz&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Nuxt + bulma on Netlify&lt;/td&gt;
&lt;td&gt;&lt;a href="http://www.pedropcruz.pt" rel="noopener noreferrer"&gt;http://www.pedropcruz.pt&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/jeffjadulco"&gt;@jeffjadulco&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gatsby + Tailwind CSS on Vercel&lt;/td&gt;
&lt;td&gt;&lt;a href="https://jeffjadulco.com" rel="noopener noreferrer"&gt;https://jeffjadulco.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/laasrinadiaa"&gt;@laasrinadiaa&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gatsby on Netlify&lt;/td&gt;
&lt;td&gt;&lt;a href="https://nadialaasri.me" rel="noopener noreferrer"&gt;https://nadialaasri.me&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/corentinbettiol"&gt;@corentinbettiol&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;PHP, MariaDB and Vanilla JS&lt;/td&gt;
&lt;td&gt;&lt;a href="https://l3m.in" rel="noopener noreferrer"&gt;https://l3m.in&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/sanchezdav"&gt;@sanchezdav&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Ruby on Rails&lt;/td&gt;
&lt;td&gt;&lt;a href="https://codeando.dev" rel="noopener noreferrer"&gt;https://codeando.dev&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/juandamartn"&gt;@juandamartn&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Vanilla JS&lt;/td&gt;
&lt;td&gt;&lt;a href="https://juandamartinez.com" rel="noopener noreferrer"&gt;https://juandamartinez.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/adamgreenough"&gt;@adamgreenough&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Wordpress&lt;/td&gt;
&lt;td&gt;&lt;a href="https://adamgreenough.me" rel="noopener noreferrer"&gt;https://adamgreenough.me&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/elvessousa"&gt;@elvessousa&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Next.js with Typescript on Vercel&lt;/td&gt;
&lt;td&gt;&lt;a href="https://elvessousa.com.br" rel="noopener noreferrer"&gt;https://elvessousa.com.br&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/jetleebruce"&gt;@jetleebruce&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Gatsbyjs, Tailwind on Netlify&lt;/td&gt;
&lt;td&gt;&lt;a href="https://modinsv.netlify.app" rel="noopener noreferrer"&gt;https://modinsv.netlify.app&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/chuksokwuenu"&gt;@chuksokwuenu&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;PHP, Javascript and MySql&lt;/td&gt;
&lt;td&gt;&lt;a href="http://chuksokwuenu.com" rel="noopener noreferrer"&gt;http://chuksokwuenu.com&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;--------&lt;/td&gt;
&lt;td&gt;--------&lt;/td&gt;
&lt;td&gt;--------&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;share yours!!&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;READY ? Let's go ! 📣&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>portfolio</category>
      <category>community</category>
    </item>
    <item>
      <title>📦 GitHub Profile: The RIGHT Way to Show your latest DEV articles + BONUS 🎁</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Wed, 05 Aug 2020 15:18:35 +0000</pubDate>
      <link>https://dev.to/viclafouch/github-profile-the-right-way-to-show-your-latest-dev-articles-bonus-398m</link>
      <guid>https://dev.to/viclafouch/github-profile-the-right-way-to-show-your-latest-dev-articles-bonus-398m</guid>
      <description>&lt;p&gt;Hello there ! 👋&lt;/p&gt;

&lt;p&gt;1 week ➡️ 1 article ! &lt;a href="https://dev.to/viclafouch"&gt;#followMe&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We just hit &lt;strong&gt;1250&lt;/strong&gt; followers ! Thank you very much ! 🥰&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As you may have noticed, it is now possible to display a &lt;strong&gt;GitHub profile&lt;/strong&gt;. 🧑‍🌾&lt;/p&gt;

&lt;p&gt;If you don't already have one, I recommend that you create one using this link below:&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/m0nica" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F18864%2F664e8e81-eeff-498e-a4dd-463d98e7f79f.png" alt="m0nica"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/m0nica/how-to-create-a-github-profile-readme-1paj" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;How To Create A GitHub Profile README&lt;/h2&gt;
      &lt;h3&gt;Monica Powell ・ Jul 11 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#github&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#branding&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#markdown&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


&lt;p&gt;Here, I'm going to show you &lt;strong&gt;how in 2 minutes it is possible to show your latest blog posts&lt;/strong&gt; directly to your &lt;strong&gt;GitHub profile&lt;/strong&gt; in an automated way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foclds3iptyxhj7ylfidt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Foclds3iptyxhj7ylfidt.png" alt="viclafouch profile" width="800" height="529"&gt;&lt;/a&gt;&lt;/p&gt;
Example of GitHub Profile



&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/viclafouch" rel="noopener noreferrer"&gt;GitHub Profile Example 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/gautamkrishnar" rel="noopener noreferrer"&gt;GitHub Profile Example 2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/khaosdoctor" rel="noopener noreferrer"&gt;GitHub Profile Example 3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Share yours in the comments below!&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Before to begin, be sure to have a Github Profile 💪
&lt;/h3&gt;

&lt;p&gt;To get a profile on GitHub, follow these 3 steps below, if you have already one, you can skip this part.&lt;/p&gt;

&lt;p&gt;1️⃣ &lt;a href="https://github.com/new" rel="noopener noreferrer"&gt;Create a new repository&lt;/a&gt; with the same name (including casing) as your GitHub username.&lt;br&gt;
2️⃣ Create a &lt;code&gt;README.md&lt;/code&gt; file inside the new repo and add your content you want to show.&lt;br&gt;
3️⃣ Commit and push your new README file!&lt;/p&gt;


&lt;h2&gt;
  
  
  Show your last 3/5/10 DEV articles 🔥
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/gautamkrishnar" rel="noopener noreferrer"&gt;@gautamkrishnar&lt;/a&gt; whom we thank 😙, has created a small package allowing us to automate the retrieval of articles on different websites (&lt;a href="https://dev.to/"&gt;Dev.to&lt;/a&gt;, &lt;a href="https://medium.com/" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;, &lt;a href="https://stackoverflow.com/" rel="noopener noreferrer"&gt;Stackoverflow&lt;/a&gt;, ...) and to show the result into your README file.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/gautamkrishnar" rel="noopener noreferrer"&gt;
        gautamkrishnar
      &lt;/a&gt; / &lt;a href="https://github.com/gautamkrishnar/blog-post-workflow" rel="noopener noreferrer"&gt;
        blog-post-workflow
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Show your latest blog posts from any sources or StackOverflow activity or Youtube Videos on your GitHub profile/project readme automatically using the RSS feed
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Step 1: Edit your &lt;strong&gt;README.md&lt;/strong&gt; 📝
&lt;/h3&gt;

&lt;p&gt;Just add these 2 little Markdown lines to your &lt;code&gt;README.md&lt;/code&gt; file. You can of course add your own content to the file, but &lt;strong&gt;these 2 lines are required&lt;/strong&gt; for the tutorial.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;&amp;lt;!-- BLOG-POST-LIST:START --&amp;gt;&lt;/span&gt;
&lt;span class="s"&gt;&amp;lt;!-- BLOG-POST-LIST:END --&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Copy the code above&lt;/strong&gt; and &lt;strong&gt;paste it&lt;/strong&gt; into your &lt;strong&gt;README.md&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example on my &lt;a href="https://github.com/viclafouch" rel="noopener noreferrer"&gt;GitHub profile&lt;/a&gt;, I placed my DEV articles at the end of my file like that: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F02dhy06zgb51za807d20.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F02dhy06zgb51za807d20.png" alt="Readme Github profile" width="800" height="201"&gt;&lt;/a&gt;&lt;/p&gt;
🚸 CODE



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F28suf2sq6arr2tibx0fr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F28suf2sq6arr2tibx0fr.png" alt="Example Github profile" width="800" height="171"&gt;&lt;/a&gt;&lt;/p&gt;
🚸 WILL RENDER AFTER STEP 2


&lt;h3&gt;
  
  
  Step 2: Create a simple bot 🤖
&lt;/h3&gt;

&lt;p&gt;Now, we have to create a &lt;strong&gt;GitHub workflow&lt;/strong&gt;. The goal 🎯 is to replace these 2 lines of markdown code by your DEV articles!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A &lt;strong&gt;workflow&lt;/strong&gt; is a configurable automated process made up of one or more jobs. You must create a YAML file to define your &lt;strong&gt;workflow&lt;/strong&gt; configuration. &lt;em&gt;&lt;a href="https://guides.github.com/introduction/flow" rel="noopener noreferrer"&gt;Understanding the GitHub flow&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To create a workflow 👇&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to the &lt;strong&gt;Actions&lt;/strong&gt; tab of your repository.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="//github.com/$USERNAME/$USERNAME/actions/new"&gt;github.com/$USERNAME/$USERNAME/actions/new&lt;/a&gt; (replace &lt;code&gt;$USERNAME&lt;/code&gt; by your GitHub username.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;e.g: &lt;a href="https://github.com/viclafouch" rel="noopener noreferrer"&gt;github.com/viclafouch/viclafouch/actions/new&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, select the simple workflow in order to start with the minimum necessary structure.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1fxdtvnuwck2cclg7mve.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1fxdtvnuwck2cclg7mve.png" alt="GitHub workflow" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Rename the &lt;code&gt;blank.yml&lt;/code&gt; file to &lt;code&gt;blog-post-workflow.yml&lt;/code&gt; and simply insert this code below:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Latest blog post workflow&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# Runs every hour&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;0&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*'&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;update-readme-with-blog&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Update this repo's README with latest blog posts&lt;/span&gt;
    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gautamkrishnar/blog-post-workflow@master&lt;/span&gt;
        &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="c1"&gt;# Your RSS feed url&lt;/span&gt;
          &lt;span class="na"&gt;feed_list&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://dev.to/feed/viclafouch"&lt;/span&gt;
          &lt;span class="c1"&gt;# Maximum number of posts you want&lt;/span&gt;
          &lt;span class="na"&gt;max_post_count&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here my &lt;a href="https://github.com/viclafouch/viclafouch/blob/master/.github/workflows/blog-post-workflow.yml" rel="noopener noreferrer"&gt;blog-post-workflow.yml file&lt;/a&gt; if you need help.&lt;/p&gt;

&lt;p&gt;2 important parameters ❗️ &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;feed_list&lt;/code&gt; which is &lt;strong&gt;required&lt;/strong&gt;! It's your RSS feed url.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;max_post_count&lt;/code&gt; which is the maximum number of posts you want to show on your readme file. Default value is &lt;code&gt;5&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can find all parameters at &lt;a href="https://github.com/gautamkrishnar/blog-post-workflow#options" rel="noopener noreferrer"&gt;gautamkrishnar/blog-post-workflow#options&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;And finally, &lt;strong&gt;confirm the creation&lt;/strong&gt; of the workflow. &lt;/p&gt;

&lt;p&gt;Now, the workflow works by itself and will retrieve every hour your DEV articles and will &lt;code&gt;commit&lt;/code&gt; and &lt;code&gt;push&lt;/code&gt; the result to your &lt;strong&gt;README.md&lt;/strong&gt; file.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: In order to avoid waiting 1 hour to see the first change appear, you can manually trigger the workflow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fp2mwru0s8ealtpwi33ln.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fp2mwru0s8ealtpwi33ln.png" alt="History commit Update" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;
BEFORE / AFTER


&lt;h2&gt;
  
  
  BONUS 🏆
&lt;/h2&gt;

&lt;p&gt;Want to show your &lt;strong&gt;latest Medium articles&lt;/strong&gt; into your Github profile, or your &lt;strong&gt;StackOverflow activity&lt;/strong&gt;, your &lt;strong&gt;blog articles&lt;/strong&gt; or even your &lt;strong&gt;YouTube videos&lt;/strong&gt; automatically ?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqrpt98h42srv1qp92hwo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqrpt98h42srv1qp92hwo.png" alt="Lucas Santos GitHub" width="800" height="609"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Following are the list of some popular blogging platforms and their RSS feed urls:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Name&lt;/th&gt;
&lt;th&gt;Feed URL&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://dev.to/"&gt;Dev.to&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://dev.to/feed/username&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://wordpress.org/" rel="noopener noreferrer"&gt;Wordpress&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://www.example.com/feed/&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://medium.com/" rel="noopener noreferrer"&gt;Medium&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://medium.com/feed/@username&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://stackoverflow.com/" rel="noopener noreferrer"&gt;Stackoverflow&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://stackoverflow.com/feeds/user/userid&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://ghost.org/" rel="noopener noreferrer"&gt;Ghost&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://www.example.com/rss/&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.drupal.org/" rel="noopener noreferrer"&gt;Drupal&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://www.example.com/rss.xml&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.youtube.com" rel="noopener noreferrer"&gt;YouTube Playlists&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://www.youtube.com/feeds/videos.xml?playlist_id=playlist_id&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://www.youtube.com" rel="noopener noreferrer"&gt;YouTube Videos&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;https://www.youtube.com/feeds/videos.xml?channel_id=channelId&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can find an example here: &lt;a href="https://github.com/viclafouch" rel="noopener noreferrer"&gt;https://github.com/viclafouch&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Do not hesitate to &lt;strong&gt;share your GitHub Profile&lt;/strong&gt; in order to show the way you have displayed your DEV articles! 😉&lt;/p&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;

&lt;p&gt;If you enjoyed this article you can follow me on &lt;a href="https://twitter.com/TrustedSheriff" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or here on &lt;a href="https://dev.to/viclafouch"&gt;dev.to&lt;/a&gt; where I regularly post bite size tips relating to HTML, CSS and JavaScript.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/cancel-properly-http-requests-in-react-hooks-and-avoid-memory-leaks-pd7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🍦 Cancel Properly HTTP Requests in React Hooks and avoid Memory Leaks 🚨&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 29 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;




&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/improve-your-productivity-with-snippets-of-javascript-on-the-chrome-devtools-3gfm" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🚜 Improve your productivity with Snippets of JavaScript on the Chrome DevTools 🍄&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 22 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#chrome&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>github</category>
      <category>markdown</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>🍦 Cancel Properly HTTP Requests in React Hooks and avoid Memory Leaks 🚨</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Wed, 29 Jul 2020 16:50:33 +0000</pubDate>
      <link>https://dev.to/viclafouch/cancel-properly-http-requests-in-react-hooks-and-avoid-memory-leaks-pd7</link>
      <guid>https://dev.to/viclafouch/cancel-properly-http-requests-in-react-hooks-and-avoid-memory-leaks-pd7</guid>
      <description>&lt;p&gt;Hello guys ! 👋&lt;/p&gt;

&lt;p&gt;Today, let's take a look at cancelling a web request with &lt;strong&gt;fetch&lt;/strong&gt; and &lt;strong&gt;Abort Controller&lt;/strong&gt; in React Hooks! 🤗&lt;/p&gt;

&lt;p&gt;When we work with Fetch to manage data, we sometimes want to cancel the request (e.g. when we leave the current page, when we leave a modal, ...).&lt;/p&gt;

&lt;p&gt;In the example below 👇, we &lt;strong&gt;fetch&lt;/strong&gt; the data to display when switching route. &lt;strong&gt;But&lt;/strong&gt;, we leave the route/page before the fetch is completed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7p2coedr8hhtdltuzxu1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7p2coedr8hhtdltuzxu1.gif" alt="React hooks memory leaks 1" width="600" height="329"&gt;&lt;/a&gt;&lt;/p&gt;
🚸 Demo 1/2



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4uoij0o2qmdlppeykeln.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4uoij0o2qmdlppeykeln.png" alt="React hooks memory leaks 2" width="800" height="443"&gt;&lt;/a&gt;&lt;/p&gt;
🚸 Source code 2/2



&lt;p&gt;We just saw a memory leak in action! 💪🏼 Let’s see why this error occurred, and what it exactly means.&lt;/p&gt;

&lt;p&gt;❓ &lt;strong&gt;WHY A MEMORY LEAK?&lt;/strong&gt;: We have a component that performs an asynchronous &lt;code&gt;fetch(url)&lt;/code&gt; task, then updates the state of the component to display the elements, &lt;strong&gt;BUT&lt;/strong&gt; we unmount the component before the request is even completed. The state of the unmounted component is updated (e.g. &lt;code&gt;setUsers&lt;/code&gt;, &lt;code&gt;setState&lt;/code&gt;), which follows a &lt;strong&gt;memory leak&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  🚀 Let's use the new AbortController API !
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Abort Controller&lt;/strong&gt; allows you to subscribe to one or more Web Requests with the ability to cancel them. 🔥&lt;/p&gt;

&lt;h3&gt;
  
  
  Basics of AbortController
&lt;/h3&gt;

&lt;p&gt;First of all, let's create a &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortController" rel="noopener noreferrer"&gt;new AbortController&lt;/a&gt; object instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffvipu2xkelip28hcfoqp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffvipu2xkelip28hcfoqp.png" alt="Abort Controller API" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, we can access to &lt;strong&gt;&lt;code&gt;controller.signal&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The signal &lt;strong&gt;&lt;code&gt;read-only&lt;/code&gt;&lt;/strong&gt; property of the &lt;code&gt;AbortController&lt;/code&gt; interface returns an &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal" rel="noopener noreferrer"&gt;AbortSignal&lt;/a&gt; object instance, which can be used to communicate with/abort a DOM request as desired." &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/AbortController" rel="noopener noreferrer"&gt;MDN Source&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's see how to use it 💪&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvlvi82bo5lk2nopqzn8z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fvlvi82bo5lk2nopqzn8z.png" alt="Abort fetch example 1" width="800" height="423"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And finally, if we want to cancel the current request, just call &lt;strong&gt;&lt;code&gt;abort()&lt;/code&gt;&lt;/strong&gt;. Also, you can get &lt;code&gt;controller.signal.aborted&lt;/code&gt; which is a &lt;code&gt;Boolean&lt;/code&gt; that indicates whether the request(s) the signal is communicating with is/are aborted (true) or not (false).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyswm5mktqv16v0tiio9e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyswm5mktqv16v0tiio9e.png" alt="Abort fetch example 2" width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;❗️ Note: When &lt;strong&gt;&lt;code&gt;abort()&lt;/code&gt;&lt;/strong&gt; is called, the &lt;code&gt;fetch()&lt;/code&gt; promise rejects with a &lt;strong&gt;&lt;code&gt;DOMException&lt;/code&gt;&lt;/strong&gt; named &lt;code&gt;AbortError&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Yeah, you just learned how to cancel a Web Request natively! 👏&lt;/p&gt;

&lt;h2&gt;
  
  
  🤩 Let's do this with React Hooks !
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ❌ &lt;strong&gt;BEFORE&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Below is an example of a component that retrieves data in order to display them:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F466wuql2ru1fgkrc2snx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F466wuql2ru1fgkrc2snx.png" alt="Memory leak react hooks 1" width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If I leave the page too fast and the request is not finished: &lt;strong&gt;MEMORY LEAK&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdaavdtgn3tvfeybcf3rq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdaavdtgn3tvfeybcf3rq.png" alt="Memory leak react hooks 2" width="800" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ &lt;strong&gt;AFTER&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;So let's &lt;code&gt;useEffect&lt;/code&gt; to subscribe to our &lt;code&gt;fetch&lt;/code&gt; request and to avoid memory leaks. We use the clean method of &lt;code&gt;useEffect&lt;/code&gt; for calling &lt;code&gt;abort()&lt;/code&gt; when our component unmount.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzsr8g1ecnburui4rkje9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fzsr8g1ecnburui4rkje9.png" alt="No memory leaks react hooks" width="800" height="549"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, no more memory leaks! 😍&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwqa6uud2tnz90okxiy1e.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwqa6uud2tnz90okxiy1e.gif" alt="Example abort controller memory leaks" width="600" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As always, feel free to reach out to me! 😉&lt;/p&gt;

&lt;p&gt;You can check this demo on &lt;a href="https://abort-with-react-hooks.vercel.app" rel="noopener noreferrer"&gt;abort-with-react-hooks.vercel.app&lt;/a&gt;.&lt;br&gt;
Also, here the source code of this article in this &lt;a href="https://gist.github.com/viclafouch/91e4782d6831a2cf95def05eba80db11" rel="noopener noreferrer"&gt;gist&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;

&lt;p&gt;If you enjoyed this article you can follow me on &lt;a href="https://twitter.com/TrustedSheriff" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or here on &lt;a href="https://dev.to/viclafouch"&gt;dev.to&lt;/a&gt; where I regularly post bite size tips relating to HTML, CSS and JavaScript.&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/improve-your-productivity-with-snippets-of-javascript-on-the-chrome-devtools-3gfm" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🚜 Improve your productivity with Snippets of JavaScript on the Chrome DevTools 🍄&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 22 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#chrome&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/5-best-places-to-find-free-svg-css-icons-for-your-websites-41c5" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;📱 5 Best Places to find free SVG/CSS icons for your websites 🪐&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 15 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#html&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#ux&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>react</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>showdev</category>
    </item>
    <item>
      <title>🚜 Improve your productivity with Snippets of JavaScript on the Chrome DevTools 🍄</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Wed, 22 Jul 2020 14:12:28 +0000</pubDate>
      <link>https://dev.to/viclafouch/improve-your-productivity-with-snippets-of-javascript-on-the-chrome-devtools-3gfm</link>
      <guid>https://dev.to/viclafouch/improve-your-productivity-with-snippets-of-javascript-on-the-chrome-devtools-3gfm</guid>
      <description>&lt;p&gt;Hello guys! 👋 &lt;/p&gt;

&lt;p&gt;Sometimes you may write the same code in your console over and over again. Why not save this piece of code directly in your web browser? Use the &lt;strong&gt;Snippets&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;Snippets have access to the JavaScript context of the page, which means that you can interact with &lt;code&gt;document&lt;/code&gt; or &lt;code&gt;window&lt;/code&gt; of any web page. It can become very effective during your work.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Next week, I will show you the &lt;strong&gt;5 best snippets&lt;/strong&gt; so be sure to &lt;a href="https://dev.to/viclafouch"&gt;follow me&lt;/a&gt; 😉&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe5nj8dykuq0h12o9q3gu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe5nj8dykuq0h12o9q3gu.gif" alt="Create Snippets of JavaScript" width="275" height="252"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a snippet
&lt;/h2&gt;

&lt;p&gt;To create a snippet, nothing could be simpler: Open the developer console, go to the "Sources" tab and in the panels, click on "Snippets".&lt;/p&gt;

&lt;p&gt;On the left of this panel are all your snippets. You can &lt;strong&gt;create&lt;/strong&gt;, &lt;strong&gt;modify&lt;/strong&gt;, &lt;strong&gt;delete&lt;/strong&gt; and &lt;strong&gt;run&lt;/strong&gt; a snippet in all tabs/pages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyfuic4rnc3rmxyot0iq7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fyfuic4rnc3rmxyot0iq7.png" alt="Sources &amp;gt; Snippets" width="800" height="601"&gt;&lt;/a&gt;&lt;/p&gt;
Sources &amp;gt; Snippets



&lt;blockquote&gt;
&lt;p&gt;You can also go to the snippets panel by using the shortcut &lt;strong&gt;Control+Shift+P&lt;/strong&gt; or &lt;strong&gt;Command+Shift+P&lt;/strong&gt; (Mac) to open the Command Menu.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdb7lpglcu57tp1kttcj3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdb7lpglcu57tp1kttcj3.png" alt="Shortcut snippet" width="800" height="601"&gt;&lt;/a&gt;&lt;/p&gt;
Control+Shift+P or Command+Shift+P



&lt;h2&gt;
  
  
  Run a snippet
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open the Snippets panel.&lt;/li&gt;
&lt;li&gt;Click the name of the Snippet that you want to run.&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;Run Snippet&lt;/code&gt;, or press &lt;strong&gt;Control+Enter&lt;/strong&gt; or &lt;strong&gt;Command+Enter&lt;/strong&gt; (Mac).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;or&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Press &lt;strong&gt;Control+o&lt;/strong&gt; or &lt;strong&gt;Command+o&lt;/strong&gt; (Mac) to open the Command Menu.&lt;/li&gt;
&lt;li&gt;Type the &lt;code&gt;!NameOfTheSnippet&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flpcceio6rn4fi91iy96k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flpcceio6rn4fi91iy96k.png" alt="Run a snippet" width="800" height="709"&gt;&lt;/a&gt;&lt;/p&gt;
Control+o or Command+o



&lt;h4&gt;
  
  
  Rename a Snippet
&lt;/h4&gt;

&lt;p&gt;Right-click on the snippet name and select &lt;code&gt;Rename&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Delete a Snippet
&lt;/h4&gt;

&lt;p&gt;Right-click on the snippet name and select &lt;code&gt;Remove&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  An example of snippets
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://gist.github.com/viclafouch/c6445aa2f0cf23f990587ad3061fd380" rel="noopener noreferrer"&gt;Design Mode&lt;/a&gt; is a tiny snippet which puts Chrome into edit mode, allowing you to edit entire pages as though you were in an HTML editor.&lt;/p&gt;

&lt;p&gt;This is very useful when you want to debug your website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1spko7uz4jnj4sdomo81.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F1spko7uz4jnj4sdomo81.png" alt="DesignMode snippet" width="800" height="264"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw00snd20sb1bb3hzvuwh.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw00snd20sb1bb3hzvuwh.gif" alt="DesignMode snippet" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the source code of the snippet in &lt;a href="https://gist.github.com/viclafouch/c6445aa2f0cf23f990587ad3061fd380" rel="noopener noreferrer"&gt;this gist&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Another example
&lt;/h2&gt;

&lt;p&gt;In the snippet bellow, I get all images and display their  informations (&lt;code&gt;height&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, &lt;code&gt;alt&lt;/code&gt;, &lt;code&gt;lazy-loading&lt;/code&gt;, etc...). Very useful!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fl8z3bqqkk1qssn56xrp4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fl8z3bqqkk1qssn56xrp4.png" alt="Snippet example chrome" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voilaaaaa 👏👏&lt;/p&gt;

&lt;p&gt;Next week, I will show you &lt;strong&gt;5 very nice snippets&lt;/strong&gt; to improve your productivity! &lt;/p&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/5-best-places-to-find-free-svg-css-icons-for-your-websites-41c5" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;📱 5 Best Places to find free SVG/CSS icons for your websites 🪐&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 15 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#html&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#ux&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/7-amazing-css-tips-and-tricks-for-linting-your-html-o5n" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🚀 7 amazing CSS tips and tricks for linting your HTML 🔥&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 8 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#html&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>productivity</category>
      <category>chrome</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>📱 5 Best Places to find free SVG/CSS icons for your websites 🪐</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Wed, 15 Jul 2020 13:55:53 +0000</pubDate>
      <link>https://dev.to/viclafouch/5-best-places-to-find-free-svg-css-icons-for-your-websites-41c5</link>
      <guid>https://dev.to/viclafouch/5-best-places-to-find-free-svg-css-icons-for-your-websites-41c5</guid>
      <description>&lt;p&gt;Hello! 🤗&lt;/p&gt;

&lt;p&gt;1 week 👉 1 article published ! &lt;a href="https://dev.to/viclafouch"&gt;#FollowMe&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here a list of 5 websites that will make you change your life about icons. They are not the best, but they are the ones who I think are among the best.&lt;/p&gt;

&lt;p&gt;The 5 websites below are open source and no registration is required.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Quick message: if you know about other great libraries, feel free to mention it in a reply.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  1. Tabler icons
&lt;/h1&gt;

&lt;p&gt;Licence: &lt;strong&gt;MIT&lt;/strong&gt;&lt;br&gt;
Website: &lt;a href="https://tabler-icons.io" rel="noopener noreferrer"&gt;tabler-icons.io&lt;/a&gt;&lt;br&gt;
Made by: &lt;a href="https://twitter.com/codecalm" rel="noopener noreferrer"&gt;@codecalm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Get more than &lt;strong&gt;550+ Customizable free SVG icons&lt;/strong&gt; with &lt;a href="https://tabler-icons.io" rel="noopener noreferrer"&gt;Tabler icons&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;A large icon set, with the possibility of customizing the stroke, color and size, being super handy if we are making wireframes or testing icons.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0fdkh9xd3jxjgzpqnkkb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0fdkh9xd3jxjgzpqnkkb.png" alt="Tabler icons" width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  2. CSS.gg
&lt;/h1&gt;

&lt;p&gt;Licence: &lt;strong&gt;MIT&lt;/strong&gt;&lt;br&gt;
Website: &lt;a href="https://css.gg" rel="noopener noreferrer"&gt;css.gg&lt;/a&gt;&lt;br&gt;
Made by: &lt;a href="https://twitter.com/AstritMalsija" rel="noopener noreferrer"&gt;@AstritMalsija&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An amazing icon library with &lt;strong&gt;+700 free icons&lt;/strong&gt; in pure #CSS.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://css.gg" rel="noopener noreferrer"&gt;css.gg&lt;/a&gt; offers a library of icons made in CSS completely free. They are of very good quality and the choice is quite consequent. You should be able to find everything you want. &lt;/p&gt;

&lt;p&gt;Also available in &lt;strong&gt;SVG&lt;/strong&gt;, &lt;strong&gt;SVG Sprite&lt;/strong&gt;, styled components, Figma and Adobe Xd formats.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5ms3tvp4hb4njgg3s8bz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5ms3tvp4hb4njgg3s8bz.png" alt="css.gg" width="800" height="398"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  3. Feather Icons
&lt;/h1&gt;

&lt;p&gt;Licence: &lt;strong&gt;MIT&lt;/strong&gt;&lt;br&gt;
Website: &lt;a href="https://feathericons.com" rel="noopener noreferrer"&gt;feathericons.com&lt;/a&gt;&lt;br&gt;
Made by: &lt;a href="https://twitter.com/colebemis" rel="noopener noreferrer"&gt;@colebemis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://feathericons.com" rel="noopener noreferrer"&gt;Feather&lt;/a&gt; is a collection of simply beautiful open source icons. Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency, and flexibility.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4oorqp7zix6wcc79yp3b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4oorqp7zix6wcc79yp3b.png" alt="feathericons.com " width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  4. unDraw
&lt;/h1&gt;

&lt;p&gt;Licence: &lt;strong&gt;MIT&lt;/strong&gt;&lt;br&gt;
Website: &lt;a href="https://undraw.co/illustrations" rel="noopener noreferrer"&gt;undraw.co&lt;/a&gt;&lt;br&gt;
Made by: &lt;a href="https://twitter.com/NinaLimpi" rel="noopener noreferrer"&gt;@NinaLimpi&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The website &lt;a href="https://undraw.co/illustrations" rel="noopener noreferrer"&gt;undraw.co&lt;/a&gt; offers a collection of 600 illustrations in SVG format for free. A search engine allows you to display images corresponding to your search. For an entire search or on a selected image, it is possible to customize the color via the tool at the top right.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2ysncatxpqfb3moj8486.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F2ysncatxpqfb3moj8486.png" alt="unDraw.co" width="800" height="435"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  5. Heroicons
&lt;/h1&gt;

&lt;p&gt;Licence: &lt;strong&gt;MIT&lt;/strong&gt;&lt;br&gt;
Website: &lt;a href="https://heroicons.dev" rel="noopener noreferrer"&gt;heroicons.dev&lt;/a&gt;&lt;br&gt;
Made by: &lt;a href="https://twitter.com/steveschoger" rel="noopener noreferrer"&gt;@steveschoger&lt;/a&gt; &lt;a href="https://twitter.com/adamwathan" rel="noopener noreferrer"&gt;@adamwathan&lt;/a&gt; &lt;a href="https://twitter.com/username_ZAYDEK" rel="noopener noreferrer"&gt;@username_ZAYDEK&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A list of SVG icons made by the creators of &lt;a href="https://twitter.com/tailwindcss" rel="noopener noreferrer"&gt;@tailwindcss&lt;/a&gt;! +170 icons currently, more to come in the future. To use these icons, simply copy the source for the icon you need.&lt;/p&gt;

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

&lt;p&gt;Voilaaa!&lt;/p&gt;

&lt;p&gt;You using another site that deserves to be shared? Indicate it in the comments below!&lt;/p&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/7-amazing-css-tips-and-tricks-for-linting-your-html-o5n" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🚀 7 amazing CSS tips and tricks for linting your HTML 🔥&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 8 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#html&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/how-to-scope-your-css-scss-in-react-js-271a" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🦄 How to scope your CSS/SCSS in React JS ⚡️&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 1 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>html</category>
      <category>css</category>
      <category>ux</category>
      <category>beginners</category>
    </item>
    <item>
      <title>🚀 7 amazing CSS tips and tricks for linting your HTML 🔥</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Wed, 08 Jul 2020 14:45:38 +0000</pubDate>
      <link>https://dev.to/viclafouch/7-amazing-css-tips-and-tricks-for-linting-your-html-o5n</link>
      <guid>https://dev.to/viclafouch/7-amazing-css-tips-and-tricks-for-linting-your-html-o5n</guid>
      <description>&lt;p&gt;Hello guys !&lt;/p&gt;

&lt;p&gt;Last week we learned &lt;a href="https://dev.to/viclafouch/how-to-scope-your-css-scss-in-react-js-271a"&gt;How to scope our CSS/SCSS in React JS&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Today, let's discover 7 tips for linting our CSS.&lt;/p&gt;

&lt;p&gt;CSS, for cascading stylesheet, is a language that will allow you to define the form to give to your document. In javascript, you probably use &lt;a href="https://eslint.org" rel="noopener noreferrer"&gt;eslint&lt;/a&gt; to check your code for errors of any kind. But in css, how can we debug our style and see the possible mistakes ?&lt;/p&gt;

&lt;p&gt;No prerequisites are required to use these tips. No package is also required.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's lint our CSS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Check &lt;code&gt;[alt]&lt;/code&gt; attribute for img
&lt;/h3&gt;

&lt;p&gt;Debug images without alt attribute with CSS. &lt;code&gt;[alt]&lt;/code&gt; must be present on all images, although it can remain empty (for purely decorative images).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft0mj1a7hd978735amo9d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft0mj1a7hd978735amo9d.png" alt="CSS alt for images" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Relation between inputs and labels
&lt;/h3&gt;

&lt;p&gt;Be sure to explicit relation between an input and its label. Use id and for attributes to do so.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flscdyz1jk44ge0ec3u9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flscdyz1jk44ge0ec3u9t.png" alt="Input and Labels attributes" width="800" height="213"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Check the order of titles
&lt;/h3&gt;

&lt;p&gt;The HTML &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; - &lt;code&gt;&amp;lt;h6&amp;gt;&lt;/code&gt; elements represent six levels of section headings. &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; is the highest section level and &lt;code&gt;&amp;lt;h6&amp;gt;&lt;/code&gt; is the lowest.&lt;/p&gt;

&lt;p&gt;You should avoid skipping heading levels.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;h2&lt;/code&gt; above &lt;code&gt;h1&lt;/code&gt; 🔴&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;h3&lt;/code&gt; above &lt;code&gt;h4&lt;/code&gt; 🟢&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;h6&lt;/code&gt; above &lt;code&gt;h5&lt;/code&gt; 🔴&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;h6&lt;/code&gt; above &lt;code&gt;h2&lt;/code&gt; 🔴&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So check if our titles is out of order.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOTE : Let's use the new &lt;code&gt;:is&lt;/code&gt; pseudo class !&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnj2trg4sqklndmphn0p8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnj2trg4sqklndmphn0p8.png" alt="CSS order headers" width="800" height="276"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. No &lt;code&gt;div&lt;/code&gt; inside inline elements
&lt;/h3&gt;

&lt;p&gt;This selector hunts for &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; inside of inline elements like a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; or a &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;You can see the usage of &lt;code&gt;:is&lt;/code&gt; selector to lint html and keep semantic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7m3r7n9x1tqo1yejvctm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7m3r7n9x1tqo1yejvctm.png" alt="CSS div inside inline" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Lang in the html document
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;html&lt;/code&gt; tag accepts lang attribute that is, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html" rel="noopener noreferrer"&gt;according to MDN&lt;/a&gt;, very important for accessibility and accessible technologies like screen readers.&lt;/p&gt;

&lt;p&gt;Why? Screenreaders take into account the language declared to adjust the pronunciation of words. A document without languages would be mispronounced. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fum23nsrafy2dvo3hj2c4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fum23nsrafy2dvo3hj2c4.png" alt="Lang HTML document" width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Prevent malicious issues for anchors
&lt;/h3&gt;

&lt;p&gt;When you link to a page on another site using the &lt;code&gt;target="_blank"&lt;/code&gt; attribute, you can expose your site to performance and security issues: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The other page may run on the same process as your page. If the other page is running a lot of JavaScript, your page's performance may suffer.&lt;/li&gt;
&lt;li&gt;The other page can access your window object with the window.opener property. This may allow the other page to redirect your page to a malicious URL.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Adding &lt;code&gt;rel="noopener"&lt;/code&gt; or &lt;code&gt;rel="noreferrer"&lt;/code&gt; to your target="_blank" links avoids these issues.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F75g1kg0au2icqxkp9tyh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F75g1kg0au2icqxkp9tyh.png" alt="Target blank security" width="800" height="192"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  7. &lt;code&gt;picture&lt;/code&gt; element must have a &lt;code&gt;.webp&lt;/code&gt; source
&lt;/h3&gt;

&lt;p&gt;According to Google, the WebP format reduces the size of images by 19 to 64%. This translates into websites that load faster and consume less bandwidth.&lt;/p&gt;

&lt;p&gt;So let’s optimize performances with .webp images.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8gatxufhvxgzf1gpveqc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8gatxufhvxgzf1gpveqc.png" alt="webp images source" width="800" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, I hope that these little tips will help you write your HTML better!&lt;/p&gt;

&lt;p&gt;You can find all the css codes in this following &lt;a href="https://gist.github.com/viclafouch/157c2572d8235f4ebd1305b69b82f964" rel="noopener noreferrer"&gt;gist&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Most of these tips can be found on the &lt;a href="https://twitter.com/hashtag/lintHTMLwithCSS" rel="noopener noreferrer"&gt;#lintHTMLwithCSS on Twitter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/how-to-scope-your-css-scss-in-react-js-271a" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🦄 How to scope your CSS/SCSS in React JS ⚡️&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jul 1 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/build-a-complete-modal-component-with-react-hooks-2fk8" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🔧 Build a complete Modal Component with React Hooks 🌈&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jun 24 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>css</category>
      <category>html</category>
      <category>beginners</category>
      <category>showdev</category>
    </item>
    <item>
      <title>🦄 How to scope your CSS/SCSS in React JS ⚡️</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Wed, 01 Jul 2020 13:41:50 +0000</pubDate>
      <link>https://dev.to/viclafouch/how-to-scope-your-css-scss-in-react-js-271a</link>
      <guid>https://dev.to/viclafouch/how-to-scope-your-css-scss-in-react-js-271a</guid>
      <description>&lt;p&gt;Hi guys ! 🤗&lt;/p&gt;

&lt;p&gt;Next article about React JS! Last week we talked about &lt;a href="https://dev.to/viclafouch/build-a-complete-modal-component-with-react-hooks-2fk8"&gt;How to build a complete Modal Component with React Hooks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This week, let's discover a little trick that will allow you to scope your &lt;strong&gt;css&lt;/strong&gt;/&lt;strong&gt;scss&lt;/strong&gt;/&lt;strong&gt;sass&lt;/strong&gt; in your React JS application.&lt;/p&gt;

&lt;p&gt;In order to solve the problem of css encapsulation, there are two main approaches, &lt;strong&gt;css-modules&lt;/strong&gt; and &lt;strong&gt;CSS-in-JS&lt;/strong&gt;. &lt;br&gt;
However, both of them have a very very big problem. The developer experience is not good, by which I mean you often have to write more code than you expect to achieve a simple style.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe83gy26d2gjte3bln198.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe83gy26d2gjte3bln198.png" alt="React SCSS Scoped" width="780" height="800"&gt;&lt;/a&gt;&lt;/p&gt;
Created with meme-studio.io



&lt;p&gt;With &lt;code&gt;react-scoped-css&lt;/code&gt; created by &lt;a href="https://github.com/gaoxiaoliangz" rel="noopener noreferrer"&gt;@gaoxiaoliangz&lt;/a&gt;, you can just write the normal css you know, while having the advantage of css encapsulation!&lt;/p&gt;
&lt;h1&gt;
  
  
  React Scoped CSS
&lt;/h1&gt;
&lt;h2&gt;
  
  
  How does it work ?
&lt;/h2&gt;

&lt;p&gt;Usually, you import your &lt;strong&gt;global style&lt;/strong&gt; file in your React application, &lt;strong&gt;or&lt;/strong&gt; you use a &lt;strong&gt;css file by component&lt;/strong&gt; if like me you like to be rigorous. But the problem with this second approach is that your style is not scoped.&lt;/p&gt;

&lt;p&gt;The scoped CSS allows you to targets a specific element and its children without any impact on other component.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installation:
&lt;/h2&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;With create-react-app&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Since create-react-app doesn't allow you to change webpack and babel config. So in this scenario, you have to use &lt;a href="https://github.com/gsoft-inc/craco/blob/master/packages/craco/README.md#installation" rel="noopener noreferrer"&gt;craco&lt;/a&gt; to override webpack config. Luckily you don't have to do it manually, just use a simple craco plugin.&lt;/p&gt;

&lt;p&gt;Setup craco following &lt;a href="https://github.com/gsoft-inc/craco/blob/master/packages/craco/README.md#installation" rel="noopener noreferrer"&gt;this guide&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# npm i craco-plugin-scoped-css --dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then, create a &lt;code&gt;craco.config.js&lt;/code&gt; in your project root and add this code:&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="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;plugin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;craco-plugin-scoped-css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Without create-react-app&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You have to add &lt;a href="https://www.npmjs.com/package/babel-plugin-react-scoped-css" rel="noopener noreferrer"&gt;one babel plugin&lt;/a&gt; and one webpack loader.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# npm i babel-plugin-react-scoped-css --dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;And in your babel config:&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="nx"&gt;plugins&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;babel-plugin-react-scoped-css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Usage:
&lt;/h2&gt;

&lt;p&gt;Just &lt;strong&gt;create your component&lt;/strong&gt; and &lt;strong&gt;import your stylesheet&lt;/strong&gt;. The css filename must be like &lt;code&gt;[name].scoped.css&lt;/code&gt; (or .scss/.sass). But you can define your own matching rule (&lt;code&gt;.scoped.css&lt;/code&gt;, &lt;code&gt;.local.scss&lt;/code&gt;, ...) in the plugin configuration.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkdtno60b3ev19ql5bcaq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkdtno60b3ev19ql5bcaq.png" alt="React CSS Scoped JSX" width="800" height="453"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your css (or scss/sass):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxa1mepb6a2odnmhucyge.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxa1mepb6a2odnmhucyge.png" alt="React CSS Scoped CSS" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Feioixlqg526papulrxva.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Feioixlqg526papulrxva.png" alt="React CSS Scoped HTML" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see in the html above, component with scoped css file imported has a unique &lt;code&gt;data-v-&amp;lt;hash&amp;gt;&lt;/code&gt; attribute.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy3d7llk90ocyfz6ajev1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fy3d7llk90ocyfz6ajev1.png" alt="React CSS Scoped CSS" width="800" height="621"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The css selector also has a corresponding hash like &lt;code&gt;selector[data-v-&amp;lt;hash&amp;gt;]&lt;/code&gt;. So all the styles in &lt;code&gt;home.scoped.css&lt;/code&gt; are scoped to &lt;code&gt;Home.jsx&lt;/code&gt;.&lt;/p&gt;
&lt;h1&gt;
  
  
  Architecture
&lt;/h1&gt;

&lt;p&gt;One common way to structure projects is to locate CSS, JS, and tests together inside folders grouped by feature or route. So here, &lt;strong&gt;let's group our JS and scoped css&lt;/strong&gt; in a folder for one component!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk3sr0dnuvkhre19rbaqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk3sr0dnuvkhre19rbaqh.png" alt="Alt Text" width="800" height="993"&gt;&lt;/a&gt;&lt;/p&gt;
Example of one of my projects



&lt;p&gt;Voilaaa&lt;/p&gt;

&lt;p&gt;You can find the Github Repo here: &lt;a href="https://github.com/gaoxiaoliangz/react-scoped-css" rel="noopener noreferrer"&gt;https://github.com/gaoxiaoliangz/react-scoped-css&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Today, I use it on most of my projects and I encourage you to try it!&lt;/p&gt;

&lt;p&gt;Cheers 🍻 🍻 🍻 &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/build-a-complete-modal-component-with-react-hooks-2fk8" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🔧 Build a complete Modal Component with React Hooks 🌈&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jun 24 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;




&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/5-useful-and-modern-custom-hooks-for-your-react-app-3dl" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;⚖️ 5 Useful and Modern Custom Hooks for your React App 🌟&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jun 17 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>react</category>
      <category>showdev</category>
      <category>javascript</category>
      <category>css</category>
    </item>
    <item>
      <title>🔧 Build a complete Modal Component with React Hooks 🌈</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Wed, 24 Jun 2020 13:34:10 +0000</pubDate>
      <link>https://dev.to/viclafouch/build-a-complete-modal-component-with-react-hooks-2fk8</link>
      <guid>https://dev.to/viclafouch/build-a-complete-modal-component-with-react-hooks-2fk8</guid>
      <description>&lt;p&gt;Hi guys ! &lt;/p&gt;

&lt;p&gt;Last week, we talked about &lt;a href="https://dev.to/viclafouch/5-useful-and-modern-custom-hooks-for-your-react-app-3dl"&gt;5 Customs React Hooks&lt;/a&gt; ! Many of you have shared this article. So this week, let's continue with React and the implementation of a Modal component &lt;strong&gt;without installing any packages&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj3fxirarskmt4zriraj0.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fj3fxirarskmt4zriraj0.gif" alt="React Modal demo" width="600" height="328"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  A Modal component from scratch
&lt;/h1&gt;

&lt;p&gt;Before starting, here are the elements we will use during this tutorial:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;React Hooks&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Portals from ReactDOM&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A little bit of CSS&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's start with our &lt;code&gt;modal.jsx&lt;/code&gt; (or &lt;code&gt;modal.js&lt;/code&gt;) file !&lt;/p&gt;

&lt;h2&gt;
  
  
  Our component:
&lt;/h2&gt;

&lt;p&gt;Let's start with the basics: the creation of our &lt;a href="https://reactjs.org/docs/hooks-state.html#hooks-and-function-components" rel="noopener noreferrer"&gt;function component&lt;/a&gt;. The goal is to include any content to the modal and to manage the opening and closing of the component.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fo6zjugob8jdmavt8l7lc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fo6zjugob8jdmavt8l7lc.png" alt="React Modal Hooks" width="800" height="285"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Secondly, what we want is a modal that is independent of our application. We don't want to have any &lt;code&gt;z-index&lt;/code&gt; concerns in css or any &lt;code&gt;overflow&lt;/code&gt; concerns. So let's insert this component into a different location in the DOM. But how?&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's introduce the Portals from ReactDOM !
&lt;/h3&gt;

&lt;p&gt;Portals provide a way to &lt;a href="https://reactjs.org/docs/portals.html" rel="noopener noreferrer"&gt;render children in a DOM node that exists outside of the DOM component&lt;/a&gt; hierarchy, that is, outside of the &lt;code&gt;#root&lt;/code&gt; or &lt;code&gt;#app&lt;/code&gt; div of your React application.&lt;/p&gt;

&lt;p&gt;First, let's add a new div to our &lt;code&gt;html&lt;/code&gt; and give it a 'modal-app' ID.  React does not create a new div, but displays the children &lt;strong&gt;in&lt;/strong&gt; that &lt;code&gt;modal-app&lt;/code&gt; div.&lt;/p&gt;

&lt;p&gt;Note that the &lt;code&gt;#modal-app&lt;/code&gt; can be any valid element of the DOM (&lt;code&gt;div&lt;/code&gt;, &lt;code&gt;section&lt;/code&gt;, &lt;code&gt;span&lt;/code&gt;...), regardless of its position.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkm8hmmrw3u4nskxla57x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fkm8hmmrw3u4nskxla57x.png" alt="React Modal HTML" width="800" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And for our component to be inserted in this &lt;code&gt;#modal-app&lt;/code&gt; div, let's use the &lt;code&gt;createPortal()&lt;/code&gt; method offered by ReactDOM.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Favkdtvkwbwd7mkb2m1go.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Favkdtvkwbwd7mkb2m1go.png" alt="React Modal ReactDOM" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Even though a portal can be anywhere in the DOM tree, it behaves like a normal React child in every other way. Features like context work exactly the same regardless of whether the child is a portal, as the portal still exists in the React tree regardless of position in the DOM tree.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Source : &lt;a href="https://reactjs.org/docs/portals.html" rel="noopener noreferrer"&gt;Portals - React&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So let's include this method for our component like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffugkk9c0fz8pvsuinpjg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffugkk9c0fz8pvsuinpjg.png" alt="React Modal Portals" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Open the Modal
&lt;/h3&gt;

&lt;p&gt;Logically, it will be the parent component that will ask the modal to open. But how could we proceed?&lt;/p&gt;

&lt;p&gt;First of all, let's add a local state to our &lt;strong&gt;Modal&lt;/strong&gt; component in order to know if the modal is open or not.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;useState&lt;/code&gt; allows us to create our state with a boolean value. A &lt;code&gt;defaultOpened&lt;/code&gt; prop will tell us if we want to open the modal directly on create. &lt;code&gt;false&lt;/code&gt; is the default value.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8dnvdvfjey4bdxcwrf3y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8dnvdvfjey4bdxcwrf3y.png" alt="Open React Modal" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;isOpen &lt;code&gt;true&lt;/code&gt; === Modal opened&lt;/li&gt;
&lt;li&gt;isOpen &lt;code&gt;false&lt;/code&gt; === Modal closed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We use the &lt;a href="https://reactjs.org/docs/conditional-rendering.html#gatsby-focus-wrapper" rel="noopener noreferrer"&gt;conditionally rendering with the JavaScript conditional operator&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7v3ikl9km5cw9asijlxm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7v3ikl9km5cw9asijlxm.png" alt="Conditionally rendering" width="800" height="129"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then, in order for the parent to change this local state, you'll have to call up the "refs". &lt;/p&gt;

&lt;p&gt;This is where &lt;a href="https://reactjs.org/docs/hooks-reference.html#useref" rel="noopener noreferrer"&gt;useRef&lt;/a&gt;, &lt;a href="https://reactjs.org/docs/hooks-reference.html#useimperativehandle" rel="noopener noreferrer"&gt;useImperativeHandle&lt;/a&gt; and &lt;a href="https://reactjs.org/docs/react-api.html#reactforwardref" rel="noopener noreferrer"&gt;forwardRef&lt;/a&gt; come in.&lt;/p&gt;

&lt;p&gt;To call &lt;code&gt;setIsOpen&lt;/code&gt; from the parent component, we need to attach a reference to our &lt;strong&gt;Modal&lt;/strong&gt;. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;useRef&lt;/code&gt; is used to attach a reference to our modal.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;forwardRef&lt;/code&gt; is used to forward the reference to the &lt;strong&gt;Modal&lt;/strong&gt; component.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;useImperativeHandle&lt;/code&gt; is used to expose methods to the parent component.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk07fcrsh524sfphdodk1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk07fcrsh524sfphdodk1.png" alt="React Modal Opening" width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Close the Modal
&lt;/h3&gt;

&lt;p&gt;Then, there are several ways to leave a modal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;By &lt;strong&gt;clicking outside the content&lt;/strong&gt; of the modal.&lt;/li&gt;
&lt;li&gt;By &lt;strong&gt;using the small cross (x)&lt;/strong&gt; of our content. &lt;/li&gt;
&lt;li&gt;By &lt;strong&gt;using the ESCAP&lt;/strong&gt; key of the keyboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;First, let's capture the &lt;code&gt;keydown&lt;/code&gt; event and check if the user use the ESCAP key of his keyboard. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;useEffect&lt;/code&gt; allowing us to create a listener on the &lt;code&gt;keydown&lt;/code&gt; event &lt;strong&gt;ONLY&lt;/strong&gt; if the modal is open. If the user uses the ESCAP key on his keyboard, then the modal closes.&lt;/p&gt;

&lt;p&gt;The result is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcluo5tzigi8aclr4xmr6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcluo5tzigi8aclr4xmr6.png" alt="React Modal close" width="800" height="432"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The CSS !
&lt;/h2&gt;

&lt;p&gt;You can find the css code &lt;a href="https://gist.github.com/viclafouch/6ee36b2cb7d28484d20f05e68b3433f9#file-styles-css" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F31j1l86ir5cfqmy0if8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F31j1l86ir5cfqmy0if8h.png" alt="React Modal usage" width="800" height="579"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Demo: &lt;a href="https://react-modal.viclafouch.vercel.app" rel="noopener noreferrer"&gt;https://react-modal.viclafouch.vercel.app&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Source code: &lt;a href="https://gist.github.com/viclafouch/6ee36b2cb7d28484d20f05e68b3433f9" rel="noopener noreferrer"&gt;https://gist.github.com/viclafouch/6ee36b2cb7d28484d20f05e68b3433f9&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Voilaaa ! Feel free to add your own modifications !&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/5-useful-and-modern-custom-hooks-for-your-react-app-3dl" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;⚖️ 5 Useful and Modern Custom Hooks for your React App 🌟&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jun 17 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#productivity&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/a-full-stack-meme-generator-with-react-hooks-express-5dc7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🎭 A Full-stack Meme Generator with React Hooks + Express 🪐&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jun 2 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>react</category>
      <category>javascript</category>
      <category>showdev</category>
    </item>
    <item>
      <title>⚖️ 5 Useful and Modern Custom Hooks for your React App 🌟</title>
      <dc:creator>Victor de la Fouchardière</dc:creator>
      <pubDate>Wed, 17 Jun 2020 13:13:00 +0000</pubDate>
      <link>https://dev.to/viclafouch/5-useful-and-modern-custom-hooks-for-your-react-app-3dl</link>
      <guid>https://dev.to/viclafouch/5-useful-and-modern-custom-hooks-for-your-react-app-3dl</guid>
      <description>&lt;p&gt;Hey guys 😃&lt;/p&gt;

&lt;p&gt;Since &lt;a href="https://reactjs.org/docs/hooks-intro.html" rel="noopener noreferrer"&gt;the introduction of Hooks in React&lt;/a&gt;, you may have used the same repetitive and redundant state logic inside several components. But with the Hooks, we can do it in a much simpler and cleaner way, thanks to &lt;strong&gt;Custom React Hooks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The different hooks shared in this article are &lt;strong&gt;simple&lt;/strong&gt; and &lt;strong&gt;avoid code repetition&lt;/strong&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  5 Custom hooks for you !
&lt;/h1&gt;

&lt;p&gt;You will find below several custom Hooks &lt;strong&gt;without the need to download packages on npm or yarn&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe8i0g3o3d48n2ojet8tj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fe8i0g3o3d48n2ojet8tj.png" alt="Meme Studio React Hooks" width="568" height="700"&gt;&lt;/a&gt;&lt;/p&gt;
Created with meme-studio.io



&lt;p&gt;This will allow you to modify them as you wish.&lt;/p&gt;

&lt;p&gt;A custom Hook is a &lt;strong&gt;JavaScript&lt;/strong&gt; function whose name starts with &lt;code&gt;use&lt;/code&gt; and that may call other Hooks. For example, &lt;code&gt;useTheme&lt;/code&gt; below is our first custom Hook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your version of React must be at least 16.8&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;useTheme&lt;/code&gt;:
&lt;/h2&gt;

&lt;p&gt;Let's start with a simple custom React Hook to help you implement a "light/dark mode" component for your application. The user setting persists to localStorage and the default value is the &lt;code&gt;prefers-color-schema&lt;/code&gt; value &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme" rel="noopener noreferrer"&gt;if this one is supported&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This hook makes it easy to &lt;strong&gt;dynamically change the appearance of your app&lt;/strong&gt; using CSS variables.&lt;/p&gt;

&lt;h3&gt;
  
  
  The hook:
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;And for the CSS, just use the &lt;code&gt;data-theme&lt;/code&gt; attribute and the power of &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties" rel="noopener noreferrer"&gt;CSS variables&lt;/a&gt; to create our themes.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;





&lt;h2&gt;
  
  
  &lt;code&gt;useViewport&lt;/code&gt;:
&lt;/h2&gt;

&lt;p&gt;The hook will allow you to easily &lt;strong&gt;manage the viewport of the user's device&lt;/strong&gt;. You will be able to retrieve the width of the screen but also to know if the screen size corresponds to a mobile, a tablet or a desktop.&lt;/p&gt;

&lt;h3&gt;
  
  
  The hook
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  How to use it:
&lt;/h3&gt;

&lt;p&gt;Your components may be different depending on the width of the screen, but here is an idea of how to use this custom React hook.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fztpqjs14n3c81ii50wuh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fztpqjs14n3c81ii50wuh.png" alt="React useViewport" width="800" height="512"&gt;&lt;/a&gt; &lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;code&gt;useClipboardApi&lt;/code&gt;:
&lt;/h2&gt;

&lt;p&gt;Do you want to &lt;strong&gt;copy a text or an image&lt;/strong&gt; and read the content from the clipboard ? Well here is a custom Hook using the new &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API" rel="noopener noreferrer"&gt;Clipboard API&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Feel free to read this article &lt;a href="https://dev.to/viclafouch/the-new-way-to-copy-an-image-or-a-text-to-clipboard-in-javascript-2n1g"&gt;How to Copy an Image or a Text to Clipboard in Javascript&lt;/a&gt; I wrote to understand how this API works and the browsers that support it.&lt;/p&gt;

&lt;p&gt;In this hook, &lt;strong&gt;two important things&lt;/strong&gt;: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Reading and writing to the clipboard are asynchronous.&lt;/li&gt;
&lt;li&gt;2 permissions are required to use the &lt;code&gt;read&lt;/code&gt; and &lt;code&gt;write&lt;/code&gt; methods of the clipboard.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The hook:
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  How to use it:
&lt;/h3&gt;

&lt;p&gt;A very popular feature on websites is the ability to copy an element to your clipboard by a single click to a button. Let's copy a dynamic text value!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4x4w5yukaul6lx0mv30u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F4x4w5yukaul6lx0mv30u.png" alt="React useClipboardAPI" width="800" height="579"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;code&gt;usePageVisibility&lt;/code&gt; :
&lt;/h2&gt;

&lt;p&gt;Have you ever wondered if the tabs/windows are using precious CPU time? Thanks to the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API" rel="noopener noreferrer"&gt;Page Visibility API&lt;/a&gt;, we can detect when users are not viewing or interacting with our website, saving them valuable resources.&lt;/p&gt;

&lt;p&gt;The visibility API allows a developer to know when a page has lost the focus. The API sends a &lt;code&gt;visibilitychange&lt;/code&gt; event of the visibility of the page.&lt;/p&gt;

&lt;p&gt;So it can be used for things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pause a video when the page has lost user focus.&lt;/li&gt;
&lt;li&gt;Change the page title.&lt;/li&gt;
&lt;li&gt;Stop an HTML5 canvas animation when a user is not on the page.&lt;/li&gt;
&lt;li&gt;Display a notification to the user only when the page is active.&lt;/li&gt;
&lt;li&gt;Stop the movement of a carousel.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The hook:
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  How to use it:
&lt;/h3&gt;

&lt;p&gt;Let's change the title of the page if the user is not viewing the page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9sse7jinto5f2nf3h5v3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9sse7jinto5f2nf3h5v3.png" alt="React usePageVisibility" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;code&gt;useScroll&lt;/code&gt;:
&lt;/h2&gt;

&lt;p&gt;With this hook, you'll be able to control the scroll &lt;code&gt;y&lt;/code&gt; of the page and to go back to the top/bottom with a smooth scroll. This can allow you to create an infinity scroll (&lt;code&gt;fetch()&lt;/code&gt; when &lt;code&gt;isAtBottom&lt;/code&gt; is &lt;code&gt;true&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  The hook:
&lt;/h3&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h3&gt;
  
  
  How to use it:
&lt;/h3&gt;

&lt;p&gt;Let's show a newsletter popup if the user has scrolled to the bottom of the page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbx4mswga9jd1p5j90l2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbx4mswga9jd1p5j90l2f.png" alt="React useScroll" width="800" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Voilaaa ! &lt;/p&gt;

&lt;p&gt;Feel free to use these modern hooks ! The links to the gists associated with this article can be found below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/viclafouch/08e76fe57fbebfb89ee9263fe9de406f" rel="noopener noreferrer"&gt;useTheme&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/viclafouch/7a5423f1ab76b22c253d3ff7c0e2c500" rel="noopener noreferrer"&gt;useViewport&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/viclafouch/cceefaa8895bd6b6a684e3aa4a5aad14" rel="noopener noreferrer"&gt;useClipboardApi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/viclafouch/52a8a6409c14220492d0183f509c76cd" rel="noopener noreferrer"&gt;usePageVisibility&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/viclafouch/259cbc31be65895833072a43d5f44d34" rel="noopener noreferrer"&gt;useScroll&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Cheers ! &lt;/p&gt;


&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/a-full-stack-meme-generator-with-react-hooks-express-5dc7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🎭 A Full-stack Meme Generator with React Hooks + Express 🪐&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jun 2 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#showdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;



&lt;div class="ltag__link"&gt;
  &lt;a href="/viclafouch" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F264616%2Fbb2fd5c3-b52c-49fd-962f-2e9e1f67c381.jpeg" alt="viclafouch"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/viclafouch/the-new-way-to-copy-an-image-or-a-text-to-clipboard-in-javascript-2n1g" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;🎉 How to Copy an Image or a Text to Clipboard in Javascript (2022) ☘️&lt;/h2&gt;
      &lt;h3&gt;Victor de la Fouchardière ・ Jun 11 '20&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#news&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#tutorial&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>react</category>
      <category>javascript</category>
      <category>productivity</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
