<?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: Mansour Mahamat</title>
    <description>The latest articles on DEV Community by Mansour Mahamat (@mahamatmans).</description>
    <link>https://dev.to/mahamatmans</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%2F321729%2Fcaadcb2a-fb3a-4da4-a4f3-4fdd944adb58.jpg</url>
      <title>DEV Community: Mansour Mahamat</title>
      <link>https://dev.to/mahamatmans</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahamatmans"/>
    <language>en</language>
    <item>
      <title>10 Best iPhone Productivity Apps to Supercharge Your Workflow</title>
      <dc:creator>Mansour Mahamat</dc:creator>
      <pubDate>Tue, 06 Aug 2024 17:16:29 +0000</pubDate>
      <link>https://dev.to/mahamatmans/10-best-iphone-productivity-apps-to-supercharge-your-workflow-4lnb</link>
      <guid>https://dev.to/mahamatmans/10-best-iphone-productivity-apps-to-supercharge-your-workflow-4lnb</guid>
      <description>&lt;p&gt;In today's fast-paced world, staying productive is key. Here are 10 of the best iPhone productivity apps that can help you streamline your work, boost your efficiency, and get more done in less time.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Todoist
&lt;/h2&gt;

&lt;p&gt;Todoist is a powerhouse when it comes to task management. Its clean interface and powerful features make it a top choice for productivity enthusiasts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it's a banger:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Intuitive task creation with natural language processing&lt;/li&gt;
&lt;li&gt;Seamless collaboration features for team projects&lt;/li&gt;
&lt;li&gt;Cross-platform synchronization&lt;/li&gt;
&lt;li&gt;Customizable labels, filters, and priorities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Todoist's ability to integrate with numerous other apps and its smart scheduling features make it an indispensable tool for managing both personal and professional tasks.&lt;/p&gt;

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

&lt;p&gt;Evernote has long been a favorite for note-taking and information organization. It's much more than just a digital notebook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key strengths:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Powerful search functionality, including text recognition in images&lt;/li&gt;
&lt;li&gt;Web clipper for saving articles and web pages&lt;/li&gt;
&lt;li&gt;Rich media support (text, images, audio, PDFs)&lt;/li&gt;
&lt;li&gt;Collaborative notebooks for team projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Evernote's versatility in capturing and organizing various types of information makes it an excellent productivity booster for researchers, writers, and professionals alike.&lt;/p&gt;

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

&lt;p&gt;Forest takes a unique approach to productivity by gamifying the process of staying focused.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What makes it special:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visual representation of focus time as growing trees&lt;/li&gt;
&lt;li&gt;Customizable focus durations&lt;/li&gt;
&lt;li&gt;Real-world impact through tree-planting initiatives&lt;/li&gt;
&lt;li&gt;Detailed statistics to track productivity trends&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By providing a tangible, rewarding experience for staying off your phone, Forest helps users overcome distractions and improve their concentration.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Notion
&lt;/h2&gt;

&lt;p&gt;Notion is a versatile all-in-one workspace that's gaining popularity among individuals and teams.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standout features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flexible structure for notes, databases, and wikis&lt;/li&gt;
&lt;li&gt;Customizable templates for various workflows&lt;/li&gt;
&lt;li&gt;Powerful relational databases&lt;/li&gt;
&lt;li&gt;Collaborative editing and commenting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notion's ability to adapt to various use cases, from personal journaling to complex project management, makes it a powerful tool for boosting productivity across different aspects of life.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Things 3
&lt;/h2&gt;

&lt;p&gt;Things 3 is a beautifully designed task manager that strikes a balance between simplicity and power.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why users love it:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean, intuitive interface&lt;/li&gt;
&lt;li&gt;Natural language input for quick task creation&lt;/li&gt;
&lt;li&gt;Calendar integration for effective planning&lt;/li&gt;
&lt;li&gt;Robust tagging system for organization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The app's focus on design and user experience makes task management feel less like a chore and more like a seamless part of your workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. IFTTT (If This Then That)
&lt;/h2&gt;

&lt;p&gt;IFTTT is an automation tool that can significantly boost your productivity by connecting various apps and services.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key advantages:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Wide range of supported apps and services&lt;/li&gt;
&lt;li&gt;Easy-to-use interface for creating custom automations&lt;/li&gt;
&lt;li&gt;Ability to streamline repetitive tasks&lt;/li&gt;
&lt;li&gt;Constant updates with new integrations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By automating routine tasks, IFTTT frees up your time and mental energy for more important work, making it a valuable addition to any productivity toolkit.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Pocket
&lt;/h2&gt;

&lt;p&gt;Pocket is a read-it-later app that helps you save and organize online content for future reference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What sets it apart:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clean, distraction-free reading interface&lt;/li&gt;
&lt;li&gt;Offline access to saved articles&lt;/li&gt;
&lt;li&gt;Tagging system for easy organization&lt;/li&gt;
&lt;li&gt;Text-to-speech feature for listening to articles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By allowing you to save interesting content for later, Pocket helps you stay focused on your current tasks while ensuring you don't miss out on valuable information.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Trello
&lt;/h2&gt;

&lt;p&gt;Trello is a visual collaboration tool that uses boards, lists, and cards to organize and prioritize projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Standout features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Intuitive drag-and-drop interface&lt;/li&gt;
&lt;li&gt;Customizable workflows with power-ups&lt;/li&gt;
&lt;li&gt;Easy collaboration and task assignment&lt;/li&gt;
&lt;li&gt;Integration with popular productivity tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Trello's flexibility makes it suitable for a wide range of projects, from personal to-do lists to complex team workflows, enhancing productivity through better organization and collaboration.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Fantastical
&lt;/h2&gt;

&lt;p&gt;Fantastical is a powerful calendar app that takes scheduling to the next level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it's exceptional:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Natural language input for quick event creation&lt;/li&gt;
&lt;li&gt;Beautiful, customizable interface&lt;/li&gt;
&lt;li&gt;Integration with various calendar services&lt;/li&gt;
&lt;li&gt;Built-in weather forecasts and travel time estimates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By streamlining calendar management and providing a more intuitive way to schedule events, Fantastical helps users make the most of their time.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. LastPass
&lt;/h2&gt;

&lt;p&gt;LastPass is a password manager that secures your digital life while saving you time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Secure storage for passwords and sensitive information&lt;/li&gt;
&lt;li&gt;Auto-fill functionality for quick logins&lt;/li&gt;
&lt;li&gt;Password generator for creating strong, unique passwords&lt;/li&gt;
&lt;li&gt;Secure sharing of passwords with trusted individuals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By eliminating the need to remember multiple passwords and streamlining the login process, LastPass not only enhances security but also saves valuable time in your daily digital interactions.&lt;/p&gt;

&lt;p&gt;These 10 apps represent some of the best productivity tools available for iPhone users. By leveraging their unique features and capabilities, you can significantly enhance your workflow, stay organized, and achieve more in your personal and professional life.&lt;/p&gt;

&lt;p&gt;Discover new app: &lt;a href="https://www.iosappfinder.com/" rel="noopener noreferrer"&gt;https://www.iosappfinder.com/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A coding challenge platform for FRONTED</title>
      <dc:creator>Mansour Mahamat</dc:creator>
      <pubDate>Wed, 03 Jan 2024 12:43:47 +0000</pubDate>
      <link>https://dev.to/mahamatmans/a-coding-challenge-platform-for-fronted-17gd</link>
      <guid>https://dev.to/mahamatmans/a-coding-challenge-platform-for-fronted-17gd</guid>
      <description>&lt;p&gt;Hi all, &lt;/p&gt;

&lt;p&gt;I just created a coding challenge platform to practice your frontend skills everyday.&lt;/p&gt;

&lt;p&gt;Everyday a new design and you can reproduce this design in HTML CSS JS or React JS &lt;/p&gt;

&lt;p&gt;Take a look here : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://coding-challenge.avocadogrowth.com"&gt;https://coding-challenge.avocadogrowth.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>development</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Next JS Authentication With Clerk</title>
      <dc:creator>Mansour Mahamat</dc:creator>
      <pubDate>Wed, 01 Nov 2023 13:46:29 +0000</pubDate>
      <link>https://dev.to/mahamatmans/next-js-authentication-with-clerk-1h9p</link>
      <guid>https://dev.to/mahamatmans/next-js-authentication-with-clerk-1h9p</guid>
      <description>&lt;p&gt;We will walk you through using Clerk and Next.js to establish authentication in your online apps in this step-by-step guide. Clerk offers a streamlined development experience as well as strong user security. You can quickly construct safe and user-friendly authentication systems when you combine it with the adaptability and efficiency of Next.js.&lt;/p&gt;

&lt;p&gt;You can do the following using Clerk:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow people to check in using their existing Google, GitHub, or other social network accounts.&lt;/li&gt;
&lt;li&gt;Allow users to log in without a password by utilizing a one-time passcode (OTP) sent to their phone.&lt;/li&gt;
&lt;li&gt;Control user accounts, responsibilities, and permissions from just one dashboard.&lt;/li&gt;
&lt;li&gt;Using built-in Clerk features like session management and password security, you can secure your app.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Setting Up Your Next.js Application
&lt;/h1&gt;

&lt;p&gt;First, let's create a new Next.js project by running the following commands in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-next-app my-clerk-app
&lt;span class="nb"&gt;cd &lt;/span&gt;my-clerk-app

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

&lt;/div&gt;



&lt;p&gt;First step is to create a Clerk account. You can do this by visiting clerk.dev and signing up for a free account.&lt;/p&gt;

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

&lt;p&gt;After logging in, click the Add application button. Give your app a name and pick all of the 'Social authentication' options you want your users to utilize.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fmansdesmez%2Fimage%2Fupload%2Fv1698609654%2FCapture_d_e%25CC%2581cran_2023-10-29_a%25CC%2580_21.00.38_qictgv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fmansdesmez%2Fimage%2Fupload%2Fv1698609654%2FCapture_d_e%25CC%2581cran_2023-10-29_a%25CC%2580_21.00.38_qictgv.png" alt="coding"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Installing Clerk in the Next.js Application
&lt;/h1&gt;

&lt;p&gt;We must add our API key to our project after installing Clerk.&lt;br&gt;
This may be accomplished by placing a.env.local file in the root directory of your Next.js project. The following settings should be included in the.env.local file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;your clerk public key&amp;gt;
&lt;span class="nv"&gt;CLERK_SECRET_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;your clerk secret key&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To get our Clerk’s public and secret keys, it's on Clerk dashboard&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fmansdesmez%2Fimage%2Fupload%2Fv1698609908%2FCapture_d_e%25CC%2581cran_2023-10-29_a%25CC%2580_21.04.54_vyvasj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fmansdesmez%2Fimage%2Fupload%2Fv1698609908%2FCapture_d_e%25CC%2581cran_2023-10-29_a%25CC%2580_21.04.54_vyvasj.png" alt="coding"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Navigate to your Next.js project's directory and run the following command to install Clerk :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add @clerk/nextjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Adding Clerk’s authentication provider
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/layout.jsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ClerkProvider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@clerk/nextjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Layout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ClerkProvider&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt; &lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;inter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/body&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/html&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ClerkProvider&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Layout&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Protecting your Application Routes
&lt;/h1&gt;

&lt;p&gt;Once you've integrated Clerk into your application, the next step is to determine which pages should be accessible to the public and which ones should require user authentication. This is achieved by creating a middleware.js file at the project's root and specifying which routes are public and which are private. In our specific scenario, we want only the home page to be accessible to the public, while the other pages should remain hidden until the user logs in to the application. You can accomplish this by implementing the following 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="c1"&gt;// Protects access from all the other pages except the home page&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;authMiddleware&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@clerk/nextjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;authMiddleware&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;publicRoutes&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;/&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="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;matcher&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;/((?!.*&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;..*|_next).*)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/(api|trpc)(.*)&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  User Registration and Login
&lt;/h1&gt;

&lt;p&gt;Clerk offers a range of pre-built components that simplify the integration of sign-in, sign-up, and other user management capabilities into your Next.js application.&lt;/p&gt;

&lt;p&gt;To implement this, navigate to the "app" folder of your project and create two new directories named "sign-up" and "sign-in". Within each of these directories, you should insert the respective code for the sign-up and sign-in functionalities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Signin
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/sign-in/pages.js&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;SignIn&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@clerk/nextjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;signIn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SignIn&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;signIn&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Signup
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/sign-in/pages.js&lt;/span&gt;

&lt;span class="c1"&gt;// app/sign-up/pages.js&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;SignUp&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@clerk/nextjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;signUp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SignUp&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;signUp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To access Clerk's login page at &lt;a href="http://localhost:3000/sign-in" rel="noopener noreferrer"&gt;http://localhost:3000/sign-in&lt;/a&gt;, make sure you have set up your Next.js application properly with Clerk and that the routes are configured correctly.&lt;/p&gt;

&lt;p&gt;Ensure the following steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Verify that Clerk has been integrated into your Next.js application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure you have a route or page set up for /sign-in in your Next.js application.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Confirm that Clerk's login components are correctly imported and rendered on the /sign-in page.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If all these steps have been completed successfully, visiting &lt;a href="http://localhost:3000/sign-in" rel="noopener noreferrer"&gt;http://localhost:3000/sign-in&lt;/a&gt; in your web browser should load Clerk's login page as intended.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fmansdesmez%2Fimage%2Fupload%2Fv1698611072%2FCapture_d_e%25CC%2581cran_2023-10-29_a%25CC%2580_21.24.19_uicndd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fmansdesmez%2Fimage%2Fupload%2Fv1698611072%2FCapture_d_e%25CC%2581cran_2023-10-29_a%25CC%2580_21.24.19_uicndd.png" alt="local"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  SignedOut and User Profile
&lt;/h1&gt;

&lt;p&gt;Clerk provides a collection of purpose-specific components, including "SignedIn," "SignedOut," and "RedirectToSignIn," designed to simplify user authentication management within our application.&lt;/p&gt;

&lt;p&gt;These components allow us to easily integrate authentication functionality into other components.&lt;/p&gt;

&lt;p&gt;With them, we can dynamically control our application's behavior based on the user's sign-in status. Additionally, we have the flexibility to trigger redirection to the sign-in page when necessary. These components significantly enhance our ability to seamlessly manage user authentication in our application.&lt;/p&gt;

&lt;p&gt;Create a new component called Navbar :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;//  components/navbar.jsx&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Navbar&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;nav&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SignedIn&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;UserButton&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/SignedIn&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SignedOut&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;SignInButton&lt;/span&gt; &lt;span class="nx"&gt;mode&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;modal&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;rounded border border-gray-400 px-3 py-0.5&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nx"&gt;Sign&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
          &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/SignInButton&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/SignedOut&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/nav&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;Navbar&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update your app/layout.jsx :&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ClerkProvider&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt; &lt;span class="nx"&gt;lang&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;inter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Navbar&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/body&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/html&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ClerkProvider&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not in your app folder create a new page called protected you should not be able to access if you're not logged :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app/protected/page.jsx&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;page&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="kr"&gt;protected&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;page&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this article, we discussed how Clerk simplifies authentication in Next.js, offering secure sign-in, sign-up, and sign-out. We explored how to handle authentication events and protect our routes.&lt;/p&gt;

&lt;p&gt;You should now have a fully authenticated application as highlighted below :&lt;/p&gt;

&lt;p&gt;Clerk is a robust authentication module that offers many advantages to Next.js apps. These advantages consist of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ease of use: Clerk integrates well with Next.js applications and is simple to use.&lt;/li&gt;
&lt;li&gt;Security: Clerk is an authenticating library that adheres to accepted security standards.&lt;/li&gt;
&lt;li&gt;Flexibility: Clerk may be tailored to match the unique requirements of your application since it is adaptable. I recommend checking out Clerk if you’re looking for a user-friendly, reliable, and adaptable authentication library for your Next.js application. You can get further details on Clerk’s website for documentation and resources. Here’s the link to the finished project on Github&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://avocadogrowth.com/en/blog/tutorials/auth-with-clerk-nextjs" rel="noopener noreferrer"&gt;ORIGINAL POST&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://avocadogrowth.com/en/blog/tutorials/auth-with-clerk-nextjs" rel="noopener noreferrer"&gt;ORIGINAL POST&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Tips on how I juggle side projects, a full-time job and family life with two children.</title>
      <dc:creator>Mansour Mahamat</dc:creator>
      <pubDate>Fri, 10 Feb 2023 16:03:41 +0000</pubDate>
      <link>https://dev.to/mahamatmans/tips-on-how-i-juggle-side-projects-a-full-time-job-and-family-life-with-two-children-111l</link>
      <guid>https://dev.to/mahamatmans/tips-on-how-i-juggle-side-projects-a-full-time-job-and-family-life-with-two-children-111l</guid>
      <description>&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%2Fcdn.discordapp.com%2Fattachments%2F989268324884049960%2F1073633754033172480%2FMans_Js_a_black_man_take_care_of_baby_while_he_is_working_on_co_54ee335e-15b4-4722-bfbb-8cb6e2742c32.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%2Fcdn.discordapp.com%2Fattachments%2F989268324884049960%2F1073633754033172480%2FMans_Js_a_black_man_take_care_of_baby_while_he_is_working_on_co_54ee335e-15b4-4722-bfbb-8cb6e2742c32.png" alt="row" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everyone says that to start your entrepreneurial journey it is easier to do it while having a full time job, the problem is that it is not that simple especially when you reconcile it with family life.&lt;br&gt;
You don’t want to neglect your full-time job, but you want to make sure your side project doesn’t die on the vine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kloutup.co" rel="noopener noreferrer"&gt;Join KloutUP&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Create strict time for your office hours and side project hours.
&lt;/h3&gt;

&lt;p&gt;Decide when you work best, and without disregarding family life, there is an order of priority.&lt;/p&gt;

&lt;p&gt;In my opinion, it is important to take a break for lunch, do something else, for example go to the gym, clear your head, go for a walk..., which suits me perfectly. Evenings for me as a father and husband are a very bad time, I prefer to spend time with my family, watching Netflix with my wife when the kids are asleep&lt;/p&gt;

&lt;p&gt;My routine is to get up between 5 and 5:30am, do my meditation and work until 8am, which gives me about 2.5 hours of personal work each morning, then start my full time at 9:30am, I often work remotely which allows me to take my children to school and pick them up at 3pm. I like to work for an hour when the kids are having a nap on Sunday, that makes 12 to 14 hours a week, which is a good amount of time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prioritise your tasks &amp;amp; Staying organized
&lt;/h3&gt;

&lt;p&gt;Even with a solid programme, you will probably run out of time. It is important to do the tasks that have the most impact on your side project first.&lt;/p&gt;

&lt;p&gt;Less important things will either be done as time sensitivity makes them more important, or they won't (in which case they probably weren't necessary in the first place).&lt;/p&gt;

&lt;p&gt;Personally I have a Trello to manage my projects, every night I prioritise the tasks I'm going to work on, sometimes I get a UI bug, it's not very urgent it can wait, other times I notice for example a user's photo not showing up it's a priority.&lt;/p&gt;

&lt;p&gt;Very important, you should never start a day without knowing what to work on, 2h-2h30 goes by quickly, this time must be beneficial&lt;/p&gt;

&lt;p&gt;Know what you'll be working on, know the requirements and specs, and know what's up next. And bonus points if features are broken down into small tasks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Set small targets for every week
&lt;/h3&gt;

&lt;p&gt;Sometimes it's a busy week, sometimes family responsibilities or sometimes you just don't feel like doing anything and that's okay! Take your time. The important thing is to make a consistent effort.&lt;/p&gt;

&lt;p&gt;I am often too busy with my office work and feel tired because of sport or the children. On those days, I make sure I do something related to my side project that doesn't weigh me down too much. It could be planning the next tasks, writing the remaining features, creating a tweet to post later or anything else small and light. But I make sure I'm working on something relevant.&lt;/p&gt;

&lt;p&gt;They always say that 1% progress is still progress. Follow this rule all the time. Even if it takes you 2 hours to do a simple footer, that's progress, that's an advance, organisation goes from there, break it down into mini-tasks and move on at your own pace&lt;/p&gt;

&lt;p&gt;Taking into account whether you have a busy or a free week, you can make a task list or a small (achievable) goal for your side project. Pursuing this goal will be fun and you will end up with something every week.&lt;/p&gt;

&lt;h3&gt;
  
  
  Don't expect perfection
&lt;/h3&gt;

&lt;p&gt;This is for everyone who is working on anything! You will have enough time to improve it later than to make it perfect now! J&lt;/p&gt;

&lt;p&gt;Let me explain! Let's say you are working on a simple web page, where you spent a week on just making a hero, super fun animated, responsive and very beautiful!&lt;br&gt;
But after a week, you will most likely lose interest in finishing the rest of the web page.Whereas if you finish the average looking web page first and then work on improving it, you will still have something to show for it!&lt;/p&gt;

&lt;h3&gt;
  
  
  Motivation
&lt;/h3&gt;

&lt;p&gt;The biggest difficulty for most people will be motivation. There are many things that can motivate a person. Money is a big one, passion, learning, having fun...&lt;/p&gt;

&lt;p&gt;Whatever it is that motivates you, keep it in mind. And remember why you started. Routine can keep you going when motivation fails you.&lt;/p&gt;

&lt;h3&gt;
  
  
  Take care of yourself
&lt;/h3&gt;

&lt;p&gt;Burn out is not fun, but it is real. And it's not good for your side project or your work. Even if you're pressed for time, prioritise good nutrition, hydration, exercise and sleep.&lt;/p&gt;

&lt;p&gt;I work out a lot, every lunch break I do MMA, JJB or fitness, after work I like to go for a walk with my family, I always take the kids for a bike ride and most importantly I LISTEN TO MY BODY&lt;/p&gt;

&lt;p&gt;Here are a few points that I hope will help you, take care of yourself and don't leave your family for coding nights alone in your corner.&lt;/p&gt;

&lt;p&gt;LOVE 🫶&lt;/p&gt;

&lt;p&gt;In case you are wondering what I am working on, an alternative to Linktree &lt;a href="https://kloutup.co" rel="noopener noreferrer"&gt;Join KloutUP&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can share your comments here and I would love to know about your passion projects too! You can also connect with me on &lt;a href="https://twitter.com/Mans_JS" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; or &lt;a href="https://www.buymeacoffee.com/maans" rel="noopener noreferrer"&gt;Buy me a coffee&lt;/a&gt; if you like my articles.&lt;/p&gt;

&lt;p&gt;Share it 🙌&lt;/p&gt;

</description>
      <category>vibecoding</category>
      <category>githubcopilot</category>
      <category>claude</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Git Hooks, robust commit with Husky, Prettier and ESLint</title>
      <dc:creator>Mansour Mahamat</dc:creator>
      <pubDate>Tue, 19 Jul 2022 10:20:27 +0000</pubDate>
      <link>https://dev.to/mahamatmans/git-hooks-robust-commit-with-husky-prettier-and-eslint-2nkk</link>
      <guid>https://dev.to/mahamatmans/git-hooks-robust-commit-with-husky-prettier-and-eslint-2nkk</guid>
      <description>&lt;p&gt;Have you ever had a moment when your code turned to be hard to read because of the style inconsistency like semicolon, string declaration with a mix of single-quote and double-quote, or bad indentation? &lt;/p&gt;

&lt;p&gt;Creating code is easy, but creating great code is not.&lt;br&gt;
We can stop poor code from being pushed in our repository through linting and formatting.&lt;/p&gt;

&lt;p&gt;Git hooks are scripts that Git executes before or after events such as commits, pushes... It’s a really cool and quick way to validate your code.&lt;/p&gt;


  &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimages.unsplash.com%2Fphoto-1532185825713-1e3ecd119b8f%3Fixlib%3Drb-1.2.1%26ixid%3DMnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8%26auto%3Dformat%26fit%3Dcrop%26w%3D1470%26q%3D80" alt="row"&gt;


&lt;p&gt;You can find the GitHub repo  &lt;a href="https://github.com/mansmahamat/commit-hoosks-husky" rel="noopener noreferrer"&gt;Here&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  What is a hook?
&lt;/h3&gt;

&lt;p&gt;A hook is simply a script that runs automatically when a particular event occurs in a Git repository. Here we will use &lt;code&gt;pre-commit&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pre-commit: This hook is triggered first even before entering the commit message;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many others, I let you look at the documentation of Husky &lt;/p&gt;

&lt;p&gt;### Why use ESLint and Prettier&lt;/p&gt;

&lt;p&gt;When building apps, it's important to have a good setup of automated and manual tools that ensures the best standards and code quality. Each project must have a linting tool to fulfill these needs&lt;/p&gt;
&lt;h3&gt;
  
  
  Tools
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🦮 Husky is a library to facilitate the creation and sharing of hooks within a project.&lt;/li&gt;
&lt;li&gt;🎨 Prettier : Keeps code formatting consistent, based on our own preferences.&lt;/li&gt;
&lt;li&gt;✅ ESLint is a tool for identifying and reporting on patterns found in JavaScript code, with the goal of making code more consistent and avoiding bugs&lt;/li&gt;
&lt;li&gt;🚧 Lint-Staged : Lints code before a commit occurs to keep production code clean.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Getting Started
&lt;/h3&gt;

&lt;p&gt;Let’s start with the React app, but you can use another technologies like Vue JS, Angular... &lt;/p&gt;

&lt;p&gt;We will create a React application by the simplest way with a single command:&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;npx&lt;/span&gt; &lt;span class="nx"&gt;create&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;react&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="nx"&gt;test&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;husky&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you should have the React application, you can run &lt;code&gt;npm run start&lt;/code&gt; from your terminal and navigate to &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding ESLint and Prettier
&lt;/h3&gt;

&lt;p&gt;ESLint is already installed in 'create-react-app` by default, but we will create custom configuration files for both ESLint and Prettier.&lt;/p&gt;

&lt;p&gt;Let's install Prettier and eslint-config-prettier and make our config files in root project directory. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
npm install --save-dev --save-exact prettier eslint-config-prettier&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create an ESLint config, select JSON format&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
npm init @eslint/config &lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add this config in your &lt;code&gt;.eslintrc.json &lt;/code&gt; file : &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
.eslintrc.json&lt;br&gt;
{&lt;br&gt;
    "env": {&lt;br&gt;
        "browser": true,&lt;br&gt;
        "es2021": true,&lt;br&gt;
        "jest": true&lt;br&gt;
    },&lt;br&gt;
    "extends": ["eslint:recommended", "plugin:react/recommended"],&lt;br&gt;
    "parserOptions": {&lt;br&gt;
        "ecmaFeatures": {&lt;br&gt;
            "jsx": true&lt;br&gt;
        },&lt;br&gt;
        "ecmaVersion": "latest",&lt;br&gt;
        "sourceType": "module"&lt;br&gt;
    },&lt;br&gt;
    "plugins": ["react"],&lt;br&gt;
    "rules": {&lt;br&gt;
        "indent": ["warn", "tab"],&lt;br&gt;
        "quotes": ["error", "single"],&lt;br&gt;
        "semi": ["error", "always"]&lt;br&gt;
    }&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A lot more errors pop in the code. &lt;br&gt;
That is ESLint enforcing our selected code style based in the config file. &lt;/p&gt;

&lt;p&gt;Before we fix these errors, let's create the Prettier config in root project.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
touch .prettierrc.json&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Add this config in your &lt;code&gt;.prettierrc.json &lt;/code&gt; file : &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
.prettierrc.json&lt;br&gt;
{&lt;br&gt;
    "tabWidth": 2,&lt;br&gt;
    "useTabs": true,&lt;br&gt;
    "printWidth": 80,&lt;br&gt;
    "semi": true,&lt;br&gt;
    "trailingComma": "es5",&lt;br&gt;
    "jsxSingleQuote": true,&lt;br&gt;
    "singleQuote": true&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Update &lt;code&gt;eslintrc.json&lt;/code&gt; to include &lt;code&gt;prettier&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
.eslintrc.json&lt;br&gt;
...,&lt;br&gt;
"extends": [&lt;br&gt;
    "extends": ["eslint:recommended", "plugin:react/recommended", "prettier"],&lt;br&gt;
],&lt;br&gt;
...,&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting Up Husky
&lt;/h3&gt;

&lt;p&gt;So, now if there are some problems with the code, we know how to check them. However, we are sometimes too busy to fix it or we just miss it.&lt;/p&gt;

&lt;p&gt;In order to force people to fix the code before commit it, we can use Husky. We need Husky to run a command before git commit runs. In this case, we use Husky to run ESLint and Prettier. &lt;/p&gt;

&lt;p&gt;If a problem is found, Husky will stop the process and commit will fail. If no problem is found, git commit will run.&lt;/p&gt;

&lt;p&gt;Install &lt;code&gt;Husky&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
npm install --save —dev husky&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Initialize our pre-commit hooks run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
npx husky-init&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This command will freshly add Husky to our project in the .husky folder. &lt;/p&gt;

&lt;p&gt;Inside this folder, we can create files that match the git hooks we want to use.&lt;/p&gt;

&lt;p&gt;Let's install lint-staged:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
npm i --save-dev lint-staged&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now go to package.json and write the following script pre-commit which runs the lint-staged in our project.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
package.json&lt;br&gt;
  "scripts": {&lt;br&gt;
    ...&lt;br&gt;
    "pre-commit": "lint-staged",&lt;br&gt;
    "prepare": "husky install"&lt;br&gt;
  },&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now create file named &lt;code&gt;.lintstagedrc&lt;/code&gt; on our root directory and let us write configuration what we want the lint-staged to do before commits.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
.lintstagedrc&lt;br&gt;
 {&lt;br&gt;
  "src/**/*.+(js|json|ts|tsx)": ["eslint"],&lt;br&gt;
  "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": ["prettier --write"]&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Inside .husky/pre-commit add the following script :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`javascript&lt;br&gt;
.husky/pre-commit&lt;/p&gt;

&lt;h1&gt;
  
  
  !/bin/sh
&lt;/h1&gt;

&lt;p&gt;. "$(dirname "$0")/_/husky.sh"&lt;/p&gt;

&lt;p&gt;npm run pre-commit&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Testing Our Setup
&lt;/h3&gt;

&lt;p&gt;I have this React file with a few errors inside :&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs2pzgyxbp7esgpkatkqw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs2pzgyxbp7esgpkatkqw.png" alt="Error Husky"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'll try to commit it, with the errors, let's see what happens.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
git add.&lt;br&gt;
git commit -m 'test commit with husky'&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;I can't commit it, I have to fix each error before, so let's fix that.&lt;/p&gt;

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

&lt;p&gt;No more errors now, let's try to commit our code again.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;javascript&lt;br&gt;
git add.&lt;br&gt;
git commit -m 'test commit with husky'&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;Success! 🥳 We have just committed proper code to our repository.&lt;/p&gt;

&lt;p&gt;Your program may not bug-less, but if it is consistent and pretty, it would be easier to debug and maintain it. Those tools are only meant to reduce the chance for potential problems to arise. At the end of the day, you and/or your team are the one in charge to make sure your code is easy to read.&lt;/p&gt;

&lt;p&gt;You can find the GitHub repo  &lt;a href="https://github.com/mansmahamat/commit-hoosks-husky" rel="noopener noreferrer"&gt;Here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>husky</category>
      <category>prettier</category>
      <category>eslint</category>
      <category>react</category>
    </item>
    <item>
      <title>Stop pushing your React API Key on GitHub 😪</title>
      <dc:creator>Mansour Mahamat</dc:creator>
      <pubDate>Fri, 03 Dec 2021 07:48:07 +0000</pubDate>
      <link>https://dev.to/mahamatmans/stop-pushing-your-react-api-key-on-github-b2j</link>
      <guid>https://dev.to/mahamatmans/stop-pushing-your-react-api-key-on-github-b2j</guid>
      <description>&lt;p&gt;Have you ever create an application with React, in this application you use external API’s and you pushed these API keys on GitHub ? &lt;/p&gt;

&lt;p&gt;Oh no bad practice now everybody can use your API key.&lt;/p&gt;

&lt;p&gt;We will see how we can avoid this and hide your API’s keys on Github, you need .env file.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to setup .env file inside React app ?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;You don’t need to install env package, this feature is available with &lt;a href="mailto:react-scripts@0.2.3"&gt;react-scripts@0.2.3&lt;/a&gt; and higher.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Make a file called .env in your project root&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside the env file, add your variables and API keys value like this :&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REACT_APP_GITHUB_API_KEY=Hello world 12345
REACT_APP_MOOVIE_API=0123456789
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;You should prefix all your variables name by REACT_APP if not it will be ignored&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Now you need to restart your React server with npm start to access these variables &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Inside your React application, you can now access these variables in using this syntax :&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{process.env.REACT_APP_GITHUB_API_KEY}
{process.env.REACT_APP_MOOVIE_API}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Now you have zero excuse to push your API key in your React application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://create-react-app.dev/docs/adding-custom-environment-variables/" rel="noopener noreferrer"&gt;Here you have the React documentation about using environment variables &lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Optional Chaining Operator</title>
      <dc:creator>Mansour Mahamat</dc:creator>
      <pubDate>Tue, 30 Nov 2021 15:14:24 +0000</pubDate>
      <link>https://dev.to/mahamatmans/optional-chaining-operator-3f72</link>
      <guid>https://dev.to/mahamatmans/optional-chaining-operator-3f72</guid>
      <description>&lt;p&gt;The idea of optional chaining is to make it easy to write code where you need to access properties or values inside an object or array that may or may not be null/undefined. Let’s take a look with this object &lt;strong&gt;&lt;u&gt;player&lt;/u&gt;&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;player&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Marquinhos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;team&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Paris Saint Germain&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;country&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Brazil&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="na"&gt;birth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="na"&gt;months&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;May&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="na"&gt;years&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1994&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's try to access a value that doesn't exist or is not available.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;console&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;number&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I'll have an error from the browser.&lt;/p&gt;

&lt;p&gt;Let's imagine we call an API and this value should exist but we have a little problem to access this data, this error will break my code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Optional Chaining Operator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The JavaScript Optional Chaining Operator is coming with ES2020 that allows us to safely access deeply nested properties of an object without having to check for the existence of each of them.&lt;/p&gt;

&lt;p&gt;All you have to do is use the “?.” operator after the property that you want to check for nullish values.&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;object&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;property&lt;/span&gt;
&lt;span class="nx"&gt;object&lt;/span&gt;&lt;span class="p"&gt;?.[&lt;/span&gt;&lt;span class="nx"&gt;expression&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In our code we can use it like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;console&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;player&lt;/span&gt;&lt;span class="o"&gt;?.&lt;/span&gt;&lt;span class="na"&gt;number&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This operation will check if the parent value exists and if it does not, it returns undefined and we don’t have error. When retrieving data from an API, we may not be 100% sure that a certain object exists in our API response.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tips</category>
    </item>
    <item>
      <title>Array cheatsheet Javascript</title>
      <dc:creator>Mansour Mahamat</dc:creator>
      <pubDate>Mon, 29 Nov 2021 14:34:10 +0000</pubDate>
      <link>https://dev.to/mahamatmans/array-cheatsheet-javascript-3mci</link>
      <guid>https://dev.to/mahamatmans/array-cheatsheet-javascript-3mci</guid>
      <description>&lt;p&gt;Variables in Javascript allow only one data to be stored at a time. However, given that it is often useful to manipulate many data, the concept of variable is sometimes insufficient, because it becomes difficult to manage a great number of distinct variables.&lt;/p&gt;

&lt;p&gt;To remedy this, Javascript proposes a data structure allowing to store all these data in a "common variable": the array.&lt;/p&gt;

&lt;p&gt;An array, in Javascript, is thus a variable which can contain several independent data, indexed by a number, called index. The index of an array is thus the element allowing to access the data stored in it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ARRAY LENGTH&lt;/strong&gt;&lt;br&gt;
The length method returns the length of the array.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY PUSH()&lt;/strong&gt;&lt;br&gt;
The push () method adds one or more elements to the end of an array and returns the new size of the array.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY POP()&lt;/strong&gt;&lt;br&gt;
The pop () method removes the last element from an array and returns that element. This method changes the length of the array.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY UNSHIFT()&lt;/strong&gt;&lt;br&gt;
The unshift () method adds one or more elements to the start of an array and returns the new length of the array.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY SHIFT()&lt;/strong&gt;&lt;br&gt;
The shift () method removes the first element from an array and returns that element. This method changes the length of the array.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY FOREACH()&lt;/strong&gt;&lt;br&gt;
The forEach () method iterates through the array elements one by one to perform a function.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY FILTER()&lt;/strong&gt;&lt;br&gt;
The filter () method creates and returns an array containing the elements that check the filter.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY MAP()&lt;/strong&gt;&lt;br&gt;
The map () method returns a new array containing all the elements of the initial array on which the function is called.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY REDUCE()&lt;/strong&gt;&lt;br&gt;
The reduce () method applies a function which is an "accumulator" and which processes each value in the array (from left to right) to reduce it to a single value.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY SLICE()&lt;/strong&gt;&lt;br&gt;
The slice () method returns an array, containing a copy of part of the original array, the portion is defined by a start index and an end index (excluded). The original array will not be modified.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY CONCAT()&lt;/strong&gt;&lt;br&gt;
The concat () method is used to merge one or more arrays by concatenating them. This method does not modify existing arrays, it returns a new array which is the result of the operation.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY JOIN()&lt;/strong&gt;&lt;br&gt;
The join () method creates and returns a new character string by concatenating all the elements of an array. The concatenation uses the comma or another string, supplied as an argument, as the separator.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;ARRAY REVERSE()&lt;/strong&gt;&lt;br&gt;
The reverse() method reverses an array. The first array element becomes the last, and the last array element becomes the first.&lt;/p&gt;

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

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
