<?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>Forem: Mohmed Ishak</title>
    <description>The latest articles on Forem by Mohmed Ishak (@ishakmohmed).</description>
    <link>https://forem.com/ishakmohmed</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%2F583562%2F3bee9b03-3dde-44f3-a222-bab48addf335.png</url>
      <title>Forem: Mohmed Ishak</title>
      <link>https://forem.com/ishakmohmed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/ishakmohmed"/>
    <language>en</language>
    <item>
      <title>Building Powerful Custom Internal Tools with ToolJet</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Wed, 06 Jul 2022 01:22:16 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/building-powerful-custom-internal-tools-with-tooljet-4io8</link>
      <guid>https://forem.com/ishakmohmed/building-powerful-custom-internal-tools-with-tooljet-4io8</guid>
      <description>&lt;p&gt;PS - Been a long time since I published an article.&lt;/p&gt;

&lt;p&gt;So you’re a startup (or a huge corporate) and you want to organise your data? Maybe you’re storing employee data on Google Sheets and want to build a CMS like tool to view/add/delete/update data. Or, you might have a &lt;strong&gt;PRODUCTION&lt;/strong&gt; database, say a MySQL database but you want to build a tool so anyone in your team can manage that database. Or, you might want to build a dashboard to show analytics of your data. So, how do you do it? There are 3 options, let’s review them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Option 1: Code the tool by yourself. Terrible idea. You have to spend time on it. Your developers would waste their time building internal tools.&lt;/li&gt;
&lt;li&gt;Option 2: Use third-party tools to build internal tools. Better idea, but still not ideal. There might be some tools to help you but they’re scattered everywhere (you need to use multiple tools for your organisation needs) and you need to pay a lot to use these tools.&lt;/li&gt;
&lt;li&gt;Option 3: Use an open-source (more developer support so app keeps getting updated/fixed all the time), powerful, low-code/no-code tool to build custom internal tool, if possible &lt;strong&gt;FOR FREE&lt;/strong&gt;. But, do such tool exists???&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I’m excited to break it to you and such tool does exist. Introducing &lt;a href="https://www.tooljet.com/" rel="noopener noreferrer"&gt;Tooljet&lt;/a&gt;, a free (with paid plans), open-source, low-code tool to build and deploy custom internal tools. Tooljet integrates seamlessly with all your favourite software/data source such as various databases (PostgreSQL, MongoDB, MySQL, Elasticsearch, Firestore, DynamoDB, Redis and more), any API endpoint (with authorization too), and external services (Stripe, Slack, Google Sheets, Airtable and so much more). If you need to use this tool immediately, head over to &lt;a href="https://www.tooljet.com/" rel="noopener noreferrer"&gt;Tooljet’s site&lt;/a&gt; to learn more.&lt;/p&gt;

&lt;p&gt;Anyway, in this tutorial, I’ll show you how you can connect and query RESTful API with Toolject, but as I said earlier, it could do much more than that.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Head over to &lt;a href="https://app.tooljet.com/" rel="noopener noreferrer"&gt;this link&lt;/a&gt; and sign up.&lt;/li&gt;
&lt;li&gt;Upon registration, you will see the something like below. Click create new application.
&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%2Fof37q5j1m42h8z7sqs39.png" alt="Mohmed Ishak"&gt;
&lt;/li&gt;
&lt;li&gt;Give it a name. Default is “v1”.
&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%2F6hoinkc8n81r4lawsmyy.png" alt="Mohmed Ishak"&gt;
&lt;/li&gt;
&lt;li&gt;You’ll see something like shown below. To your left, you have a couple of buttons, one of them being the &lt;code&gt;Sources&lt;/code&gt; button, in which you can configure any data source, say from a database, or an API endpoint, or spreadsheet, and much more. To your right, you have a whole lot of UI elements such as table, inputs, charts, PDF component, graphs, and even ability to add custom components. For this tutorial, our source of data will be a public API endpoint, so please click the &lt;code&gt;Create query&lt;/code&gt; button to your bottom left.
&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%2F2o8rn1ahzg9fpnkote20.png" alt="Mohmed Ishak"&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;code&gt;REST API&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Make a &lt;code&gt;GET&lt;/code&gt; request to the following endpoint: &lt;a href="https://jsonplaceholder.typicode.com/comments" rel="noopener noreferrer"&gt;https://jsonplaceholder.typicode.com/comments&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In an actual project, you can use your own endpoint - no problem! Then click &lt;code&gt;Preview&lt;/code&gt; to see whether data is successfully fetched, and when you’re confident on your config, click &lt;code&gt;Create &amp;amp; Run&lt;/code&gt;.&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%2Fz7co2kjbp6ev9pm1zpg0.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%2Fz7co2kjbp6ev9pm1zpg0.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you did it correctly, you’ll see the response data like I did. Here’s my result:
&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%2Fw7vsjxpaicv4ymkp30r8.png" alt="Mohmed Ishak"&gt;
See that JSON? Yeah it’s cool, but it’ll be even cooler if we can grab some keys and display them in a table, so let’s do that. So, from your right, drag and drop the &lt;code&gt;Table&lt;/code&gt; component.&lt;/li&gt;
&lt;li&gt;If you hover over your table, to your top left, you’ll see a gear icon, click that.
&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%2Fey3tb23qriwkjvby80fc.png" alt="Mohmed Ishak"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before we proceed, let’s make things clear, okay? From the JSON response earlier, let’s pick the &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;name&lt;/code&gt; for simplicity.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;For that reason, click the icon with 6 dots for each column at the section to your right for this table.&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%2Fmstln1oenlk4lkn9mv78.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%2Fmstln1oenlk4lkn9mv78.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Change those 2 column names to &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;name&lt;/code&gt; respectively. Delete the extra column. Click &lt;code&gt;Save &amp;amp; Run&lt;/code&gt;. The results will now be displayed in a table.&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%2Fn9gmw34oy8id5pyej1rc.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%2Fn9gmw34oy8id5pyej1rc.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Pretty cool, huh? This tool supports other HTTP verbs too like &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;, etc. So, &lt;strong&gt;what did you understand from this tutorial?&lt;/strong&gt; I hope you understood that you’ve just found an open-source tool to create and query REST APIs really quickly with no code at all. How convenient! My advice? Use this tool now, or bookmark this article for future use. Tooljet doesn’t only support REST API but also integration with popular databases, third-party services and so much more.&lt;/p&gt;

&lt;p&gt;As a professional software developer as a popular airlines in Malaysia, I can assure you that Tooljet is really powerful and is a must-use tool for any pro developer or any organisation. If you want to learn more about Tooljet, you can head over to &lt;a href="https://aviyel.com/search?term=tooljet" rel="noopener noreferrer"&gt;Aviyel’s page on Tooljet&lt;/a&gt; here. See you later.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Ever Wondered How To Develop International Websites With Multiple Languages?</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Tue, 01 Mar 2022 18:11:24 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/ever-wondered-how-to-develop-international-websites-with-multiple-languages-3mo5</link>
      <guid>https://forem.com/ishakmohmed/ever-wondered-how-to-develop-international-websites-with-multiple-languages-3mo5</guid>
      <description>&lt;p&gt;I've never cared about creating sites/apps in any other language asides English. The problem is, not everyone knows English, and a few weeks ago, my company required my team and I to develop an app for them with multi-language support. &lt;strong&gt;How can you implement this feature?&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If you find this article interesting/useful, you owe me a like.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Disclaimer
&lt;/h3&gt;

&lt;p&gt;I'm about to teach you how to implement translation in React/React Native, but don't worry if you use other library/framework. I'm sure there's an alternative and it would work similar with the solution I'm about to tell you.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Naive Approach
&lt;/h3&gt;

&lt;p&gt;If you're an original thinker, here's how you'd do it. You might store a global variable, whether using &lt;strong&gt;Redux&lt;/strong&gt; or &lt;strong&gt;Context API&lt;/strong&gt; for each language you're supporting. That variable will be changed whenever the user changes the language. Also, the app will be dependent on that variable, and you might write explicit &lt;code&gt;if-else&lt;/code&gt; or &lt;code&gt;switch-case&lt;/code&gt; statements to render right content depending on the language. If you're slightly more advanced, you'd create separate &lt;code&gt;JSON&lt;/code&gt; files for each language which would have key-value pairs of content and access them accordingly.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Ideal Approach
&lt;/h3&gt;

&lt;p&gt;The previous method involves too much manual tasks. What if there's a library that could handle all these long, repetitive steps and abstract all the complexities?&lt;/p&gt;

&lt;p&gt;There's a &lt;code&gt;NPM&lt;/code&gt; package called &lt;code&gt;react-i18next&lt;/code&gt; which solves this problem (it's also capable of more powerful stuffs too). &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 1: install dependencies&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&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;i18next&lt;/span&gt; &lt;span class="nx"&gt;i18next&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nx"&gt;save&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Step 2: add translation files&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's assume we're gonna support English and Arabic. Go ahead and add new files in these directories.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src/translations/english/common.json&lt;/code&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="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;greeting&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;Welcome.&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;p&gt;&lt;code&gt;src/translations/arabic/common.json&lt;/code&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="p"&gt;{&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;message&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;greeting&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Step 3: edit&lt;/strong&gt; &lt;code&gt;index.js&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;I18nextProvider&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;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;i18next&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;i18next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./App&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;englishContent&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;./translations/english/common.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;arabicContent&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;./translations/arabic/common.json&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;i18next&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;init&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;interpolation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;escapeValue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; 
    &lt;span class="na"&gt;lng&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;                              
    &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;en&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;common&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;englishContent&lt;/span&gt;             
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;ar&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;common&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;arabicContent&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="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;render&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;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;StrictMode&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;I18nextProvider&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;i18next&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;App&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;/I18nextProvider&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;/React.StrictMode&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;,
&lt;/span&gt;    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;root&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;ul&gt;
&lt;li&gt;&lt;strong&gt;Step 4: translate!&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use the &lt;code&gt;t&lt;/code&gt; function and supply key from your JSON file as shown below. You can access this function from any file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;useTranslation&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;react-i18next&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;common&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; 
    &lt;span class="c1"&gt;// "common" because that's the name of files we created.&lt;/span&gt;
    &lt;span class="c1"&gt;// There are variations to this,&lt;/span&gt;
    &lt;span class="c1"&gt;// but I don't want to confuse you (you can&lt;/span&gt;
    &lt;span class="c1"&gt;// check the docs for more info)&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;h1&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;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message.greeting)}&amp;lt;/h1&amp;gt;;
}

export default Component;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  But How Do You Change Language?
&lt;/h3&gt;

&lt;p&gt;If you paid attention to the code, in &lt;code&gt;index.js&lt;/code&gt;, we used &lt;code&gt;en&lt;/code&gt; and &lt;code&gt;ar&lt;/code&gt; keys to represent English and Arabic. So, now we just need to change these keys to that of desired language using built-in function from &lt;code&gt;i18next&lt;/code&gt; when the user switches the language (by clicking a button or something) and the changes will be reflected immediately.&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;function&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useTranslation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;common&lt;/span&gt;&lt;span class="dl"&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&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;t&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message.greeting&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="na"&gt;framework&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;React&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;})}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&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;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&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="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;changeLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;en&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;English&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="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&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="nx"&gt;i18n&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;changeLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ar&lt;/span&gt;&lt;span class="dl"&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="nx"&gt;عربي&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;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;You can learn more from the official docs &lt;a href="https://react.i18next.com/"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you find this article useful, you owe me a like. 😜&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactnative</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Scared Of Chrome Dev Tools? How To Inspect API Calls Without Getting Overwhelmed.</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Mon, 14 Feb 2022 14:43:55 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/scared-of-chrome-dev-tools-how-to-inspect-api-calls-without-getting-overwhelmed-64g</link>
      <guid>https://forem.com/ishakmohmed/scared-of-chrome-dev-tools-how-to-inspect-api-calls-without-getting-overwhelmed-64g</guid>
      <description>&lt;p&gt;So, you know a frontend library and a backend language and built a bunch of full stack apps? Cool. &lt;/p&gt;

&lt;p&gt;What's not cool is when you're working in a frontend team and you have little to no communication to backend team (or when there's limited docs). &lt;/p&gt;

&lt;p&gt;Or, what if you've joined a new team, and the frontend codebase is &lt;strong&gt;wwwaaaaaaaaayyyyyyyyyyy&lt;/strong&gt; too overwhelming and you don't know exactly what request you're sending to the backend and what response you're getting?&lt;/p&gt;

&lt;h3&gt;
  
  
  I'm Gonna Teach You How To Use Inspect Network Calls In Chrome Dev Tools
&lt;/h3&gt;

&lt;p&gt;I'm sure you're wondering why we're not using Postman. The reason is because with Postman, you can hit a specific API endpoint with whatever headers or body you set. With Chrome Dev Tools, you can see which set of API endpoints your app is calling when you perform some action (say when you click a button), and so you'll understand you app's behaviours better.&lt;/p&gt;

&lt;p&gt;Anyway, head over to &lt;a href="https://dev.to"&gt;https://dev.to&lt;/a&gt;, right click on any area, and click the &lt;code&gt;Inspect&lt;/code&gt; tab. Then in Chrome Dev Tools, click the &lt;code&gt;Network&lt;/code&gt; tab. You should see something like this.&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%2F7xivkc7jghfvzkvyff0t.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%2F7xivkc7jghfvzkvyff0t.png" alt="Mohmed Ishak" width="800" height="500"&gt;&lt;/a&gt;&lt;br&gt;
Keep an eye on the &lt;code&gt;clear&lt;/code&gt; icon on top left to clear a bunch of records which you will see in while. &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%2Fpp0u9lgp5b9ean3i8lnk.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%2Fpp0u9lgp5b9ean3i8lnk.png" alt="Mohmed Ishak" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hit the &lt;code&gt;Latest&lt;/code&gt; tab on DEV Community's website. On your Dev Tools, you'll see a bunch of API calls. &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%2Fio8dggtg8pvwf3ise3te.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%2Fio8dggtg8pvwf3ise3te.png" alt="Mohmed Ishak" width="800" height="350"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;If it's a type of &lt;code&gt;xhr&lt;/code&gt;, that means, it's an API call (XMLHttpRequest). Some of them might be ambiguous while others would seem kinda familiar. &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%2Fze715el17lqhx5y5lsxe.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%2Fze715el17lqhx5y5lsxe.png" alt="Mohmed Ishak" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What did you learn from this? To put it simple, if you click a button, and you expect it to call the backend, and if it's not reflected on Chrome Dev Tools as you expected, it's time to fix your code! &lt;/p&gt;

&lt;p&gt;Also, do take note of query string parameters. Under &lt;code&gt;Payload&lt;/code&gt; tab, you'll see query string parameters (used in backend) which are appended to your base URL. For example, for the URL &lt;code&gt;https://www.youtube.com?user=ishak&amp;amp;limit=20&amp;amp;category=latest&lt;/code&gt;, the query string parameters are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;user: ishak&lt;/li&gt;
&lt;li&gt;limit: 20&lt;/li&gt;
&lt;li&gt;category: latest&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's it guys. If Chrome Dev Tools seems less scary to you know, you owe me a...&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;LIKE&lt;/span&gt; &lt;span class="err"&gt;👍&lt;/span&gt;


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

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>Quick Summary - The Technologies That Tech Corporates Use To Build Software (For Beginners)</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Sat, 15 Jan 2022 07:25:22 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/quick-summary-the-technologies-that-tech-corporates-use-to-build-software-for-beginners-1m6m</link>
      <guid>https://forem.com/ishakmohmed/quick-summary-the-technologies-that-tech-corporates-use-to-build-software-for-beginners-1m6m</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;introduction&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;you&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;ve&lt;/span&gt; &lt;span class="n"&gt;already&lt;/span&gt; &lt;span class="n"&gt;been&lt;/span&gt; &lt;span class="n"&gt;working&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;large&lt;/span&gt; &lt;span class="n"&gt;tech&lt;/span&gt; &lt;span class="n"&gt;team&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&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="s"&gt;"This article is probably not for you."&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;you&lt;/span&gt;&lt;span class="err"&gt;'&lt;/span&gt;&lt;span class="n"&gt;re&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;curious&lt;/span&gt; &lt;span class="n"&gt;guy&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;topic&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&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="s"&gt;"This article is for you."&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;introduction&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;then&lt;/span&gt;&lt;span class="o"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;likeThisPost&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;shareThisPost&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anyway, how does a large team work together to build a software product? &lt;/p&gt;

&lt;h3&gt;
  
  
  [1] Communication Channel
&lt;/h3&gt;

&lt;p&gt;To communicate, there are a whole lot of options. Some prefer to use internal tools, while others prefer software like Discord or Slack. Videoconferencing? You guessed it - Google Meet, Microsoft Teams, or Zoom. &lt;/p&gt;

&lt;h3&gt;
  
  
  [2] Code Collaboration
&lt;/h3&gt;

&lt;p&gt;GitHub or GitLab. I see that newer companies start to transition to GitLab because it's offers more convenience when dealing with CI/CD pipeline. Nonetheless, they're both good.&lt;/p&gt;

&lt;h3&gt;
  
  
  [3] Documentation
&lt;/h3&gt;

&lt;p&gt;For every software, there's gonna be a documentation so it's easier for anyone in the team or future engineers to test and work on it. One popular tool is Atlassian Confluence which lets you to write amazing documentations and collaborate with your team members.&lt;/p&gt;

&lt;h3&gt;
  
  
  [4] Frontend, Backend, &amp;amp; Other Tools
&lt;/h3&gt;

&lt;p&gt;For web frontend, it really is up to the company, but React.js + Next.js seems to be very popular. Angular is popular too but it just stresses out the developers a bit. For backend, currently Node.js is popular, but a lot of companies are transitioning to Go because it's faster, more secure, and costs less in the cloud generally. For mobile app development, although Flutter seems to be slightly more popular among individual developers, large tech corporates and startups prefer to use React Native because it works so well. On top of that, it is super similar to React, so a web dev can in a company can transition to mobile app dev easily and vice versa. For database, most of them use both relational (MySQL/PostgreSQL) &amp;amp; non-relational (MongoDB &amp;amp; Redis). There is much more to this, but this is a pretty good overview in my opinion.&lt;/p&gt;

&lt;h3&gt;
  
  
  [5] Project Management &amp;amp; Testing
&lt;/h3&gt;

&lt;p&gt;To manage project, usually Jira is used where the project manager would divide a project to specific tasks and assign them to developers. After development &amp;amp; testing, the devs can mark each task as done and so on. Jira is much more complex, but this is the essence of it. Anyway, to test apps, they'd use a lot of tech for load testing and so on, but one example I wanna tell you is Appium &amp;amp; Selenium, which allow you make automated testing. This means that once the test is run, the testing program would click buttons, fill up forms, and perform any task that a human could do in an app automatically (of course, you have to program the workflow). Encountered bugs will be reported to senior quality assurance engineer, usually.&lt;/p&gt;

&lt;p&gt;That's it guys. Leave a like before you go. ;)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Checking Vulnerabilities in Termux Android Application Using MobSF</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Tue, 04 Jan 2022 09:10:33 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/checking-vulnerabilities-in-termux-android-application-using-mobsf-39l3</link>
      <guid>https://forem.com/ishakmohmed/checking-vulnerabilities-in-termux-android-application-using-mobsf-39l3</guid>
      <description>&lt;p&gt;Read full article for free on Aviyel &lt;a href="https://aviyel.com/post/1542/checking-vulnerabilities-in-termux-android-application-using-mobsf"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://termux.com/"&gt;Termux&lt;/a&gt;, as a mobile app has gained recent traction in the last few months. Today, we’re going to test it using another app called &lt;a href="https://mobsf.github.io/docs/#/"&gt;MobSF&lt;/a&gt; (Mobile Security Framework) by dragging and dropping that app into MobSF and viewing key insights on &lt;a href="https://aviyel.com/post/1389/strengthen-your-android-or-ios-application-security-using-mobsf-learn-by-example-2021"&gt;Termux’s security&lt;/a&gt;, because the truth is, modern developers don’t really know how to efficiently view security vulnerabilities in their apps, and the only way we secure our apps usually (including me) is by writing some test cases, not committing environment variables to the repository.&lt;/p&gt;




&lt;h3&gt;
  
  
  What is Termux?
&lt;/h3&gt;

&lt;p&gt;Termux is just an example of an Android app that we’re going to test, and this means you can replace it with any app you want like WhatsApp APK or anything. Termux is an Android terminal emulator and Linux environment app that works on your Android. If this sounds confusing, basically using a computer, you always have access to powerful terminals, but not from a mobile phone. Because of this, you cannot perform useful tasks that you would do from a computer using a phone such as using SSH to connect to a remote server. Here are some of the cool features of Termux which are advertised:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Secure&lt;/strong&gt;: you can securely access remote servers using SSH client from OpenSSH from your smartphones. Basically, your phone now has access to a powerful terminal through emulation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feature packed&lt;/strong&gt;: you have full control over which terminal you want to use such as Bash, Zsh, and so on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customizable&lt;/strong&gt;: Termux is already powerful by default but they don’t stop you from installing additional packages/libraries from the APT package management system from some popular distros of Linux such as Ubuntu and Debian.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Very flexible&lt;/strong&gt;: you can connect a Bluetooth keyboard to your phone and use keyboard shortcuts that you would use on your computer and all the commands will work.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’d like to know more about Termux, you can view the homepage &lt;a href="https://termux.com/"&gt;here&lt;/a&gt;. The homepage looks simple, but when you click the link that will redirect to its wiki, you’ll access more pages and you’ll realize how powerful Termux is in though. But remember, the goal of this article is to teach you how to test any app using Mobile Security Framework (MobSF), so let’s take a look at that.&lt;/p&gt;




&lt;h3&gt;
  
  
  What is Mobile Security Framework (MobSF)?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://mobsf.github.io/docs/#/"&gt;Mobile Security Framework or MobSF&lt;/a&gt; is an automated and comprehensive open source mobile security tool (Android/iOS/Windows) that can check vulnerabilities for your application and do everything of that nature easily. This includes things like penetration testing, malware analysis, and so on. It’s a very complex app but so easy to use. It supports mobile app binaries such as APK, IPA, and so on so all you have to do is just drag and drop your mobile app file to this tool and it’ll do all the magic of finding security vulnerabilities behind the scenes. Why is this cool and useful? Because honestly, modern developers (including me) tend to learn the shiny new mobile development technologies such as React Native, Flutter, and so on, but they don’t know how to test the security of their app. Sure, they do know how to make secure decisions every now and then such as not committing secrets to repositories, securing databases, and so on, but still, that’s just the basics. MobSF helps you by identifying all kinds of &lt;a href="https://aviyel.com/post/1489/build-a-saas-application-and-fix-vulnerabilities-using-mobsf"&gt;security vulnerabilities&lt;/a&gt; which I’ll explain later in this article. For now, let’s just get started with installing it.&lt;/p&gt;




&lt;h3&gt;
  
  
  How to Install MobSF?
&lt;/h3&gt;

&lt;p&gt;There are two ways to install it, one is using the manual method (&lt;strong&gt;advantage&lt;/strong&gt;: you can perform dynamic analysis which is more relevant, &lt;strong&gt;disadvantage&lt;/strong&gt;: setting it up on your machine may be slightly complicated). The next is by using Docker (&lt;strong&gt;advantage&lt;/strong&gt;: you just need to install Docker and type in a command and everything that MobSF needs to run on your machine will be automatically downloaded without you having to do anything and MobSF will be available to access on your browser in localhost:8000, &lt;strong&gt;disadvantage&lt;/strong&gt;: you cannot perform dynamic analysis using real-time data).&lt;/p&gt;

&lt;p&gt;I will show you both ways. First, the manual way. If you want to run MobSF this way on your machine, you need to install other technologies in your machine depending on your OS.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Therefore, download the required technologies from &lt;a href="https://mobsf.github.io/docs/#/requirements"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Next, clone the repository which is available on GitHub (just open a terminal in your computer and type: git clone &lt;a href="https://github.com/MobSF/Mobile-Security-Framework-MobSF.git.What"&gt;https://github.com/MobSF/Mobile-Security-Framework-MobSF.git.What&lt;/a&gt; the above command means is that you are cloning (means downloading)&lt;/li&gt;
&lt;li&gt;MobSF which is hosted on GitHub to your machine.&lt;/li&gt;
&lt;li&gt;Next, get into that folder using this command: cd&lt;/li&gt;
&lt;li&gt;Next, run setup.bat file by typing: setup.bat&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you face any errors, don’t worry. You can Google them or just read the official instructions/docs &lt;a href="https://mobsf.github.io/docs/#/installation"&gt;here&lt;/a&gt;. MobSF will be available in localhost:8000 on your browser (I mean just type localhost:8000 in the URL bar and you’ll be able to access it).&lt;/p&gt;

&lt;p&gt;Remember I told you there are two ways to install MobSF? Above is the first way and the second way is to use Docker. Although both of these ways have their own disadvantages, I prefer to use Docker because I’m just used to pulling Docker images and honestly, there’s a million percent better chance that you will be able to run software using Docker rather than trying to run it manually.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To run using Docker, just make sure you have Docker installed first. If not, install it &lt;a href="https://www.docker.com/products/docker-desktop"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Now, make sure the Docker engine is turned on. If you don’t know how, you can search it on Stack Overflow, but I’m sure you know about it.&lt;/li&gt;
&lt;li&gt;Now, type: &lt;code&gt;docker run -it --rm -p 8000:8000 opensecurity/mobile-security-framework-mobsf:latest&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this command, Docker will pull the MobSF image from Docker Hub and run it in your machine. If you don’t know Docker, let me explain it in a way that you’d understand. Basically, you just have to install Docker and type the above command. Then, Docker will automatically install MobSF, Git, Python, and every tech it is dependent on without you having to download them. Now, you just need to head over to localhost:8000 to access MobSF.&lt;/p&gt;




&lt;h3&gt;
  
  
  How to Analyze Security Vulnerability with MobSF Now That You Are Running It on Termux?
&lt;/h3&gt;

&lt;p&gt;First, we want to test Termux, right? So, download Termux &lt;a href="https://f-droid.org/packages/com.termux/"&gt;here&lt;/a&gt;. You don’t have to install it on your mobile phone. Before I explain further, I want to say that the version of Termux I downloaded for the sake of writing this article is version 0.117 and the version of MobSF is version 3.4.5 (beta).&lt;/p&gt;

&lt;p&gt;Just to make sure we’re on the same page, once you launched MobSF earlier, you should have seen something like the screenshot below on your browser (URL: localhost:8000).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OG38Av1P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qtcpypdpvmf8gki2sog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OG38Av1P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6qtcpypdpvmf8gki2sog.png" alt="Mohmed Ishak" width="760" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Actually, there’s only one step here. Just drag and drop that APK file to MobSF and wait for the report.&lt;/p&gt;




&lt;h3&gt;
  
  
  How to Read Security Report from MobSF?
&lt;/h3&gt;

&lt;p&gt;If you followed all the instructions, you just made a static analysis which is so powerful. But, if you’d like to see more real-time analysis you can try &lt;a href="https://aviyel.com/post/519/mobile-security-framework-mobsf-for-automated-mobile-security-testing"&gt;dynamic analysis&lt;/a&gt; after reading this article by following instructions &lt;a href="https://mobsf.github.io/docs/#/dynamic_analyzer"&gt;here&lt;/a&gt;. Anyway, here’s how your screen will look like after the static analysis.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_Olx8vc0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwmupsxb2hwxp7wh01d7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_Olx8vc0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bwmupsxb2hwxp7wh01d7.png" alt="Mohmed Ishak" width="760" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may click these individual tabs to your left and I’m sure you’ll be able to understand it because of how descriptive MobSF is, but now I’ll just highlight some of the important stats.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, signer certificate. It shows whether the APK is signed or not, who signed it, serial number, and so on so you’ll know who developed it and related data.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PxQ0pKoo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ap501nu649ejzsiyuoxt.png" alt="Mohmed Ishak" width="760" height="427"&gt;
&lt;/li&gt;
&lt;li&gt;Next, this is a serious one. It tells you all the permissions this app would ask alongside the severity. Not sure if you can read the small texts below, but based on the report generated for Termux version 0.117 by MobSF version 3.4.5 (beta) as in the screenshot below, one of the permissions is &lt;code&gt;android.permission.REQUEST_INSTALL_PACKAGES&lt;/code&gt; which allows an application to request installing packages. If users allow it, Termux can try and trick users into installing additional malicious packages. If you think I explained all this info at this point from my knowledge, that’s not right. Actually, all these are explained in the report.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ekdmVPAT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2wxvrdswt3f0cofkpjh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ekdmVPAT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2wxvrdswt3f0cofkpjh.png" alt="Mohmed Ishak" width="760" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will also check your code line by line and analyze it, and tell you what’s wrong in terms of security. As in the screenshot below, it says that “App can read/write to External Storage. Any App can read data written to External Storage”, and the severity is high. It even tells you which file(s) contain this vulnerability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AQKyO1-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/io1p50613cgk8yc7635h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AQKyO1-p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/io1p50613cgk8yc7635h.png" alt="Mohmed Ishak" width="760" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There are so much more insights MobSF gives you such as binary analysis, APIs that are used, hardcoded secrets, and so much more. I leave it up to you to explore by yourself because it’s pretty easy since all you need to do is to click those tabs on your left and check the stats one by one and mark the ones you need the most for your future use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So that’s all about MobSF. All while, honestly (like super honestly), I didn’t know how to test the security of the apps I’ve built, but now things seem to be so much easier with MobSF. I’ll just let MobSF do all the hard work of finding vulnerabilities while I’ll focus on building features for my apps. As for Termux, it can do so much more and if you’d like to know more, you can read a discussion on Termux I stumbled upon earlier &lt;a href="https://www.quora.com/What-can-I-do-with-Termux"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The conclusion is, just because you might not know how to test securities in your mobile apps, don’t skip this part because this is too crucial. Even if you know how to test the security of your mobile apps, you can still use MobSF to test your apps as the developers have done the hard work (you don’t need to) to implement a whole lot of features that will be helpful in testing mobile app security. If you like this article, do share it with your friends cause MobSF and Termux are so cool and it only takes you a couple of seconds to share it with your friends in exchange for the amazing exposure I’ve given you to test the security of your &lt;a href="https://aviyel.com/post/773/simplifying-and-automating-mobile-security-testing-through-mobsf"&gt;mobile apps&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>security</category>
      <category>android</category>
      <category>termux</category>
    </item>
    <item>
      <title>The 1 JavaScript Mistake That Costed Me 2 Days (As A Pretty Experienced Developer)</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Mon, 13 Dec 2021 15:36:43 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/the-1-javascript-mistake-that-costed-me-2-days-as-a-pretty-experienced-developer-3ia0</link>
      <guid>https://forem.com/ishakmohmed/the-1-javascript-mistake-that-costed-me-2-days-as-a-pretty-experienced-developer-3ia0</guid>
      <description>&lt;p&gt;Hey, guys! Do you still remember the first time you encountered a serious bug in programming? I'm sure you got stuck like crazy and couldn't move on for days, weeks, or even months. In this article, I'll share with you a particular mistake that costed me 2 days, and my sanity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Array From Hell in Node.js
&lt;/h3&gt;

&lt;p&gt;Here's the task you wanna accomplish. Look at the code snippet below.&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;endAVotingSession&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;asyncHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;votingSession&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;VotingSession&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Types&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ObjectId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;arrayThatWillBeModified&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;votingSession&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;candidates&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;arrayThatWillBeModified&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Modify the array&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;VotingSession&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;updateOne&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;mongoose&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Types&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ObjectId&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;params&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&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;candidates&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;arrayThatWillBeModified&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;What we're doing is that we're grabbing an array that is returned by MongoDB, and then modifying it, and finally updating it. &lt;/p&gt;

&lt;h4&gt;
  
  
  The question is, will it work?
&lt;/h4&gt;

&lt;p&gt;Nope. It will throw an error. Wanna know the error? It took me 1 to 2 days to solve it. The error is, in the line which I wrote...&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;let&lt;/span&gt; &lt;span class="nx"&gt;arrayThatWillBeModified&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;votingSession&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;candidates&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;...we as developers might assume that candidates is an array (WHICH IS ABSOLUTELY TRUE), and we would do all sorts of things with it like I did here, where I wrote a loop that presumably modified the array. &lt;/p&gt;

&lt;p&gt;The problem is, that array (&lt;code&gt;votingSession.candidates&lt;/code&gt;) is a Mongoose array, and it seems that you can't just modify it. Instead, you need to convert it to JavaScript array, and then you can modify your array. The solution:&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;let&lt;/span&gt; &lt;span class="nx"&gt;arrayThatWillBeModified&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;votingSession&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;candidates&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toObject&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="c1"&gt;// .toObject() converts Mongoose array to JavaScript array&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The not so cool thing is, even if you log that Mongoose array in console, everything would appear fine, and you'll see an array with the right data. That's it for today guys. If you like this article, leave a like. Thank you. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>reactnative</category>
      <category>node</category>
    </item>
    <item>
      <title>How To Easily Create Cool Progress Bar in Your Web App?</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Thu, 02 Dec 2021 14:54:43 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/how-to-easily-create-cool-progress-bar-in-your-web-app-1cak</link>
      <guid>https://forem.com/ishakmohmed/how-to-easily-create-cool-progress-bar-in-your-web-app-1cak</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UEewT6zZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/czyaipxp33ebktswrfuc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UEewT6zZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/czyaipxp33ebktswrfuc.png" alt="Mohmed Ishak" width="463" height="94"&gt;&lt;/a&gt;&lt;br&gt;
Hello, devs! Do you see the picture above? That blue line is a progress bar. It tells you how much if a web app has loaded or not. It is not super important for a web app, but it really helps you to retain user's attention while the page loads for a second or two. So, how do you create that?&lt;/p&gt;

&lt;p&gt;Of course, we're gonna use a package because someone else worked hard already to implement this, so why not use it? The package is called &lt;a href="https://www.npmjs.com/package/nprogress"&gt;NProgress&lt;/a&gt;. In this article, I'll teach you how to implement it using Next.js, but if I'm sure you'll be able to implement it in other technologies such as plain React and so on. &lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1
&lt;/h3&gt;

&lt;p&gt;Install NProgress package with this 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;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;nprogress&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2
&lt;/h3&gt;

&lt;p&gt;In any main file such as _app.js (Next.js devs would know), just import these stuffs I've imported (refer code snippet below). Then, inside your component, paste the first three lines which I wrote under &lt;code&gt;function JustAComponent() { ...&lt;/code&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="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;nprogress&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;nprogress&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useRouter&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;next/router&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;JustAComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onRouteChangeStart&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="nx"&gt;nprogress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onRouteChangeComplete&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="nx"&gt;nprogress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onRouteChangeError&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="nx"&gt;nprogress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3
&lt;/h3&gt;

&lt;p&gt;Now it's time to style your progress bar. Add a file called &lt;code&gt;nprogress.css&lt;/code&gt; in your codebase and link your app to it. In my case, since I'm using Next.js, I connected that CSS file using the link tag.&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;link&lt;/span&gt; &lt;span class="nx"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;stylesheet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text/css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/nprogress.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4
&lt;/h3&gt;

&lt;p&gt;If you copy and paste the code snippet below, you'll be able to see the exact bar which I shared at the very top of this article, but feel free to play around with it and change stuffs like color, width of progress bar, etc.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nf"&gt;#nprogress&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;pointer-events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;#nprogress&lt;/span&gt; &lt;span class="nc"&gt;.bar&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--progressBar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;fixed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1031&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#3943b7&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;#nprogress&lt;/span&gt; &lt;span class="nc"&gt;.peg&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--progressBar&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--progressBar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;-webkit-transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-4px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;-ms-transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-4px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3deg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;-4px&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;Done. If you like this article, all I need is just a like. :)&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>javascript</category>
      <category>react</category>
      <category>css</category>
    </item>
    <item>
      <title>How to Create Awesome README File For Your GitHub Repository</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Sun, 21 Nov 2021 07:55:24 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/how-to-create-awesome-readme-file-for-your-github-repository-4i92</link>
      <guid>https://forem.com/ishakmohmed/how-to-create-awesome-readme-file-for-your-github-repository-4i92</guid>
      <description>&lt;p&gt;Hello, devs! If your README file doesn't look good, no one will be interested on your repo. So, how do you create nice READMEs? One way is to learn markdown format and use your creativity to make amazing READMEs, but in my opinion, this is waste of time because markdowns are not used directly in your app, but only for documentation reasons. What is there's a tool that lets you create cool READMEs real quick without you having to learn or know the boring markdown?&lt;/p&gt;

&lt;p&gt;Luckily, there's a tool that allows you to do exactly that with a WYSIWYG editor. You just need to click some buttons, drag and drop, and type the content of your README without writing confusing markdown symbols, and that tool is....&lt;/p&gt;

&lt;h3&gt;
  
  
  readme.so
&lt;/h3&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%2Fladz78gzpe9w0udtnhph.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%2Fladz78gzpe9w0udtnhph.PNG" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With this tool, you just have to select a component from the section to your left such as installation component or feedback component, and this site will give you boilerplate with markdown template, and you just need to edit the content to your liking. The view on your very right shows how the actual README file will look like once published. When you're happy, just copy the entire code and paste it in your repo's README. &lt;/p&gt;

&lt;p&gt;Yeah, thank you.&lt;/p&gt;

</description>
      <category>github</category>
      <category>documentation</category>
    </item>
    <item>
      <title>Why Chatwoot is My Favorite Open Source Project? Integrations, Integrations, and Integrations.</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Wed, 10 Nov 2021 10:44:57 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/why-chatwoot-is-my-favorite-open-source-project-integrations-integrations-and-integrations-4b81</link>
      <guid>https://forem.com/ishakmohmed/why-chatwoot-is-my-favorite-open-source-project-integrations-integrations-and-integrations-4b81</guid>
      <description>&lt;p&gt;&lt;a href="https://aviyel.com/post/1328/why-chatwoot-is-my-favorite-open-source-project-integrations-integrations-and-integrations" rel="noopener noreferrer"&gt;Full article available on Aviyel for free (leave a like here before you check it out on Aviyel)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you’re a business owner or you work in a large team, you’ll probably be overwhelmed by the number of messages that you receive from customers via mail, Telegram, Twitter, Facebook (recently rebranded to Meta) Messenger, and so on. &lt;a href="https://aviyel.com/post/184/the-ultimate-open-source-alternative-to-manage-customer-engagement-chatwoot-is-here" rel="noopener noreferrer"&gt;Chatwoot&lt;/a&gt; solves this problem by &lt;a href="https://aviyel.com/post/802/how-to-integrate-facebook-whatsapp-and-slack-into-your-customer-engagement-platform" rel="noopener noreferrer"&gt;integrating all your social media platforms&lt;/a&gt; into a single dashboard so you can connect with your customers from one app. It is an open-source project so you can be assured with engineers working 24/7 to improve this product from all over the world. Moreover, the live chat feature allows your agents to communicate with the customers instantly, leaving no chance for user dissatisfaction.&lt;/p&gt;

&lt;p&gt;Plus, it ensures that all customers from all different types of social media would not be neglected. This is important because the success of a business in my opinion starts with you taking care of the customer and working backward.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You never build fancy software without knowing whether the customers need it first.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this post, I’ll take you through Chatwoot’s architecture and how you can integrate the self-hosting &lt;a href="https://aviyel.com/post/751/beginning-with-chatwoot-an-open-source-customer-engagement-platform" rel="noopener noreferrer"&gt;customer engagement platform&lt;/a&gt; with your social media channels.&lt;/p&gt;

&lt;h3&gt;
  
  
  Chatwoot Architecture
&lt;/h3&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%2Fipexwqsgguca3y9g7007.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%2Fipexwqsgguca3y9g7007.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To know more, you may refer to the &lt;a href="https://www.chatwoot.com/docs/self-hosted/deployment/architecture" rel="noopener noreferrer"&gt;architecture written in official docs&lt;/a&gt;. To run Chatwoot in production (means to deploy it live for public use), you need these components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Chatwoot web servers (built using Ruby or Node.js)&lt;/li&gt;
&lt;li&gt;Chatwoot workers (such as Sidekiq for Ruby)&lt;/li&gt;
&lt;li&gt;PostgreSQL database&lt;/li&gt;
&lt;li&gt;Email service (such as SendGrid by Twilio)&lt;/li&gt;
&lt;li&gt;Object storage (such as AWS S3)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have got these parts in your application (which might look complicated in my article but I can assure you it’s not), Chatwoot will do its magic and allow you to seamlessly interact with a whole lot of customers effortlessly. There are two recommended methods for deploying Chatwoot which I don’t want to write here because they’re documented clearly in the official docs, and they are using &lt;a href="https://www.chatwoot.com/docs/self-hosted/deployment/heroku" rel="noopener noreferrer"&gt;Heroku&lt;/a&gt; or &lt;a href="https://www.chatwoot.com/docs/self-hosted/deployment/caprover" rel="noopener noreferrer"&gt;Caprover&lt;/a&gt;. You can also use &lt;a href="https://www.chatwoot.com/docs/self-hosted/deployment/docker" rel="noopener noreferrer"&gt;Docker&lt;/a&gt; which may get slightly complicated for beginners, but if you are a little friendly towards docker-compose and Nginx, you’re good to go.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Choose Chatwoot?
&lt;/h3&gt;

&lt;p&gt;Chatwoot doesn’t have any bloatware features, but only the ones you need. Here are some of the features of Chatwoot that bought me in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integrations with platforms that businesses really use in 2021 include &lt;a href="https://aviyel.com/post/264/how-to-integrate-chatwoot-with-slack-rasa-dialogflow-and-deploy-on-facebook-whatsapp-or-twilio" rel="noopener noreferrer"&gt;Slack, Dialogflow, Calendly,&lt;/a&gt; Shopify, WooCommerce, WordPress, Stripe, FullContact, and so on.&lt;/li&gt;
&lt;li&gt;Create &lt;a href="https://www.chatwoot.com/docs/product/features/campaigns" rel="noopener noreferrer"&gt;campaigns&lt;/a&gt;: That means when you have a lot of contacts (customers) saved, you can select a list of users and send a one-time message such as festive greetings, promotions, etc. On the other hand, you can also create ongoing campaigns where Chatwoot would take a much personalized approach where you can send a certain message if a user stayed on your page for x minutes (and there’s a lot of variations of conditions you can create) by just clicking a couple of buttons in the simple UI.&lt;/li&gt;
&lt;/ul&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%2F99q1gxcopdzc9s2st3x6.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%2F99q1gxcopdzc9s2st3x6.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.chatwoot.com/docs/user-guide/features/canned-responses" rel="noopener noreferrer"&gt;Canned responses&lt;/a&gt;: Basically, you don’t want to manually type out the repetitive responses to your customers. So you can set type ‘/’ followed by a shortcode which you will set such as “greet” to automatically fill the input box with the long greeting message.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.chatwoot.com/docs/product/others/interactive-messages" rel="noopener noreferrer"&gt;Interactive messages&lt;/a&gt;: With this, your customers wouldn’t only get text messages but also interactive ones where they can make selections, order a product, and so on in the chatbox itself.&lt;/li&gt;
&lt;/ul&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%2Fmeq1ij2lw9cjruad1f9r.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%2Fmeq1ij2lw9cjruad1f9r.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;And a lot of other features like managing contacts easily, conversation workflow (users say something like ‘hi’ and a certain reply is given and the conversation is carried in this manner without you having to answer them), &lt;a href="https://aviyel.com/post/399/try-chatwoot-an-open-source-customer-engagement-suite-to-set-up-multilingual-live-chat-support" rel="noopener noreferrer"&gt;multilingual support&lt;/a&gt;, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Integrations in Chatwoot
&lt;/h3&gt;

&lt;p&gt;First, let me show you how to integrate all your social media to Chatwoot’s powerful dashboard.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, register to Chatwoot &lt;a href="https://app.chatwoot.com/app/auth/signup" rel="noopener noreferrer"&gt;here&lt;/a&gt;. I believe there’s no need for me to explain this step-by-step as it could bore you (and I’m sure you would know how to register). You can also &lt;a href="https://aviyel.com/post/801/how-to-contribute-to-chatwoot-on-github" rel="noopener noreferrer"&gt;contribute to Chatwoot on Github&lt;/a&gt; easily.&lt;/li&gt;
&lt;/ul&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%2Fzowtzzhhwkrsxkkdzg41.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%2Fzowtzzhhwkrsxkkdzg41.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upon registration, you will see your dashboard. If this dashboard looks complicated, trust me, this looks very clean compared to other alternatives to Chatwoot. Click “Inboxes” in the column to your left and then click “Integrations”.&lt;/li&gt;
&lt;li&gt;You’ll see options(s) such as Slack integrations and so on. As of writing this article, I only saw the Slack option being displayed as the other platforms are set to be integrated in the near future. If you want to integrate your Slack account, click connect for the Slack option. You can also use &lt;a href="https://aviyel.com/post/323/use-chatwoot-to-set-up-a-chatbot-with-rasa-and-dialogflow" rel="noopener noreferrer"&gt;Chatwoot with Rasa&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Enter your Slack URL in the displayed form, grant the required permission, and that’s it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/d4gwpPJGXtc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;With this, you can sync your Slack messages with Chatwoot in its dashboard. To connect with WhatsApp, Twitter, or other social platforms, you should click the same &lt;strong&gt;“Inboxes”&lt;/strong&gt; button like in the previous step and then click &lt;strong&gt;“Add Inbox”&lt;/strong&gt;. The rest of the steps are easy, just provide the information that is asked. For instance, if you select WhatsApp, you need to provide your phone number, Twilio Account SID, and a little more data and you’re good to go.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing Chatwoot to Your System
&lt;/h3&gt;

&lt;p&gt;Now, I’ll explain how to install &lt;a href="https://aviyel.com/post/263/chatwoot-with-next-js" rel="noopener noreferrer"&gt;Chatwoot using Next.js&lt;/a&gt; because I believe that Next.js is most likely to be used by companies in 2021 to build websites as it has a bunch of powerful features such out of the box as code-splitting, server-side rendering, image optimization, etc.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anyway, just like previous instructions that I’ve written in this article, click the same “Inboxes” button in the left column on your Chatwoot app and click “Add Inbox”. Then click “Website” because you want to integrate Chatwoot to your site.&lt;/li&gt;
&lt;/ul&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%2Fsqgjma6ye38q73l2rm8d.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%2Fsqgjma6ye38q73l2rm8d.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fill up the necessary details such as your website URL, and so on. At the end of the step, you’ll be given a short script based on the information you’ve given like the following image. Refer to this &lt;a href="https://aviyel.com/post/263/chatwoot-with-next-js" rel="noopener noreferrer"&gt;source&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&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%2F040pur21afnjcurcmzuo.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%2F040pur21afnjcurcmzuo.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remember the script Chatwoot gave you? In your project folder, add a file named chatwoot.js or whatever you want to call and paste the script (without script tag because we’re using Next.js, not vanilla JavaScript).&lt;/li&gt;
&lt;li&gt;Go to index.js file and add the script. Here’s a simple template.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Script&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;next/script&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="err"&gt;​​&lt;/span&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;​​&lt;/span&gt; &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
&lt;span class="err"&gt;​​ &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
&lt;span class="err"&gt;​​ &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
         &lt;span class="nx"&gt;All&lt;/span&gt; &lt;span class="nx"&gt;implementation&lt;/span&gt; &lt;span class="nx"&gt;stay&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;usual&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;but&lt;/span&gt; &lt;span class="nx"&gt;just&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;script&lt;/span&gt; 
         &lt;span class="nx"&gt;below&lt;/span&gt;
       &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
​​ &lt;/span&gt; &lt;span class="err"&gt; &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Script&lt;/span&gt; &lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/chatwoot.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="err"&gt;​​ &lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
​​&lt;/span&gt; &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;​​&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="err"&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;Home&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Done. You’ll see a clickable blue button at the bottom right of your site which will pull up Chatwoot’s chat box and Chatwoot will be up and running in no time.&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%2Fyxlnw6jrbddqdlthluzh.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%2Fyxlnw6jrbddqdlthluzh.png" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s all for today. As you can see, Chatwoot is very powerful and convenient to use. Even if you don’t need this tool right now, do remember it as you’ll surely need it in the future when you build bigger projects or work in a larger team. If you find this article useful, drop a like and share this with your friends and the tech community that you’re in.&lt;/p&gt;

&lt;p&gt;Also, Aviyel is partnering with Chatwoot to scale open source projects within communities. You can checkout &lt;a href="https://aviyel.com/discussions" rel="noopener noreferrer"&gt;Aviyel discussions&lt;/a&gt; and follow their &lt;a href="https://twitter.com/aviyelhq?lang=en" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; space.&lt;/p&gt;

</description>
      <category>chatwoot</category>
      <category>react</category>
      <category>nextjs</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The Simplest (I Genuinely Promise) Way To Seed/Populate Fake Data In MongoDB Using Node</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Thu, 28 Oct 2021 22:32:34 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/the-simplest-i-genuinely-promise-way-to-seedpopulate-fake-data-in-mongodb-using-node-21cj</link>
      <guid>https://forem.com/ishakmohmed/the-simplest-i-genuinely-promise-way-to-seedpopulate-fake-data-in-mongodb-using-node-21cj</guid>
      <description>&lt;p&gt;Only this short and concise explanation is mine, but credits to &lt;a href="https://www.youtube.com/watch?v=V30Rpqi6kYE&amp;amp;t=1s&amp;amp;ab_channel=Academind" rel="noopener noreferrer"&gt;Maximilian Schwarzmüller&lt;/a&gt; from Academind for teaching me this trick.&lt;/p&gt;

&lt;p&gt;Hey guys, have you ever wondered how to seed some mock data to your MongoDB database, whether for development/demo purposes or in actual production app? In this article, I will show you the easiest way to populate MongoDB database with very little code, and no, you wouldn't use fancy methods like the following ones.&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%2F435rhitb1qc9pjmzjfdn.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%2F435rhitb1qc9pjmzjfdn.PNG" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Make Sure Your Backend Is Up and Running
&lt;/h3&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="c1"&gt;// a bunch of codes go here...&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;connectDb&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;./utils/connectDb.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// MongoDB database connection&lt;/span&gt;
&lt;span class="nf"&gt;connectDb&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// To recognize incoming request as JSON object&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="c1"&gt;// a bunch of codes go here...&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;I bet a portion of your &lt;code&gt;index.js&lt;/code&gt; or &lt;code&gt;server.js&lt;/code&gt; file looks like this. The above is just a sample code snippet to make sure we're on the same page. Basically, if your backend which uses MongoDB is up and running, you're all set to seed the data. If not, you can Google how to set up a Node.js and Express.js server and it's easy as there are tons of tutorials teaching you how to do so.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Create Seed Script
&lt;/h3&gt;

&lt;p&gt;Create a file called &lt;code&gt;seedScript.js&lt;/code&gt; or whatever you want to call it. Before you populate your data, you must have a model/schema, and I'm sure you know that. In this file, all you need to do are 3 things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Import relevant model&lt;/li&gt;
&lt;li&gt;Create an array of fake data which will satisfy that model&lt;/li&gt;
&lt;li&gt;Make a simple function to loop through that array and save each documents&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's a sample. You can copy and paste my code, but change whatever necessary. As for the variable called &lt;code&gt;done&lt;/code&gt; and function &lt;code&gt;seedData&lt;/code&gt;, just copy them blindly (if you're rushing) from the following code snippet.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Driver&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;../models/driverModel.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;mongoose&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;mongoose&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;drivers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Driver&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="s2"&gt;Tony Stark&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&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="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Driver&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="s2"&gt;Amelia&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;location&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;19&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;span class="c1"&gt;// You can blindly copy the code snippet from the next line onwards&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;done&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&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;seedData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &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;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;Driver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;deleteMany&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt;

    &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;drivers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;drivers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="o"&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;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mock data is seeded from seed script.&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;p&gt;Here's the explanation. First, all you're doing is creating an array of objects where each object will be saved as document in MongoDB. Then, if you take a look at the &lt;code&gt;seedData&lt;/code&gt; function, what's happening is that we're deleting previous data (in case you have populated them before) and freshly populating them for every new connection.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Don't Forget to Call That Function
&lt;/h3&gt;

&lt;p&gt;In your &lt;code&gt;index.js&lt;/code&gt; or &lt;code&gt;server.js&lt;/code&gt;, or whatever entry point file of yours, just call that function. In this case, I'm calling that function after connecting to database and after using express.json() middleware. It works for me, and I haven't really tried other arrangements.&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;// A bunch of codes go here...&lt;/span&gt;

&lt;span class="c1"&gt;// MongoDB database connection&lt;/span&gt;
&lt;span class="nf"&gt;connectDb&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// To recognize incoming request as JSON object&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;

&lt;span class="c1"&gt;// Mock data seeding&lt;/span&gt;
&lt;span class="nf"&gt;seedData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// A bunch of codes go here...&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;That's it. Thank you for reading.&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>node</category>
    </item>
    <item>
      <title>This Free Tool Lets You Create World Class Documentation for React Components</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Mon, 11 Oct 2021 16:52:31 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/this-free-tool-lets-you-create-world-class-documentation-for-react-components-2gdc</link>
      <guid>https://forem.com/ishakmohmed/this-free-tool-lets-you-create-world-class-documentation-for-react-components-2gdc</guid>
      <description>&lt;p&gt;&lt;a href="https://aviyel.com/post/1161/this-free-tool-lets-you-create-world-class-documentation-for-react-components" rel="noopener noreferrer"&gt;Full article available on Aviyel for free (leave a like here before you check it out on Aviyel)&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hello, developers! I bet you know &lt;a href="https://aviyel.com/post/873/top-six-devtools-to-start-with-react" rel="noopener noreferrer"&gt;React&lt;/a&gt; and love it, but let’s time travel to the time when you didn’t know about it. You didn’t know where to start, so you probably watched a video of a guy telling you about React and found yourself stuck in tutorial hell. But look at you now. You are well versed with React and can easily create documentation for React components in one go.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Do Developers Require Documentation?
&lt;/h3&gt;

&lt;p&gt;When software solves a problem and makes the lives of others (including developers) easy, it’s good software. But what truly drives a large fanbase is the developers behind it. Imagine if React didn’t exist and you created it over a weekend or two. Not many people would try it out and your tech will be forgotten (the worst-case scenario), someone else would create similar tech better than yours unless you document your tech, driving more users and developers.&lt;/p&gt;

&lt;p&gt;Documentation is simply a report (without strict format) on how to use a tech usually created by its creators so others can get friendly with that tech and figure out its usages easily. Imagine if your beautiful documentation for a tech you created (the tech doesn’t necessarily need to be big like the entire React library or Angular framework) got noticed by popular software engineers like &lt;a href="https://www.youtube.com/channel/UCaO6VoaYJv4kS-TQO_M-N_g" rel="noopener noreferrer"&gt;Clément Mihailescu&lt;/a&gt;, or &lt;a href="https://www.youtube.com/c/akshaymarch7" rel="noopener noreferrer"&gt;Akshay Saini&lt;/a&gt; and they try your tech and love it. The next thing you know is that your code becomes popular and you either get employed at your favorite company or turn that tech into a startup and become successful and wealthy. Your documentation, if open sourced might widen new avenues of community growth, collaboration and might connect you with big shots of the industry as well.&lt;/p&gt;

&lt;h3&gt;
  
  
  Is It Difficult To Create Good Docs?
&lt;/h3&gt;

&lt;p&gt;Is it difficult to super cool and professional docs like the following ones? If you want to do it manually by implementing all the fancy UI components, yes, of course. Have you checked out &lt;a href="https://docs.expo.dev/" rel="noopener noreferrer"&gt;Expo&lt;/a&gt;’s (a toolchain built on top of React Native) documentation? They don’t just write a bunch of texts describing how to use their components, rather they’ve got editable codes for components, which means the users are able to edit the displayed code snippet (e.g. “color = black” to “color = yellow”) right on the site and the changes will be immediately visible on screen. With this, users are able to grasp the behavior of a component in an interactive way, which is the ideal way to learn for a developer. You can also check out &lt;a href="https://flutter.dev/docs" rel="noopener noreferrer"&gt;Flutter&lt;/a&gt; and &lt;a href="https://mui.com/getting-started/usage/" rel="noopener noreferrer"&gt;Material UI&lt;/a&gt; for inspiration on creating better documentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the Best Way to Document Your React Components?
&lt;/h3&gt;

&lt;p&gt;You can have all the money in the world and hire the best web developers to manually create a beautiful site for your documentation but to be honest, that’s just so time-consuming and a burden to make all parts of docs consistent and by the time you try to make it consistent, the entire team is exhausted just to make a doc? Thankfully, the open source community has put in tons of work to create a tool that will help you to create high-quality, professional, powerful, and sleek software documentations. And, before you think that I’m about to make you pay to use that software, well no, the tool I’m about to share with you is absolutely free!&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%2Fpxontwa04vz1tt39b5jm.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxontwa04vz1tt39b5jm.jpeg" alt="Mohmed Ishak"&gt;&lt;/a&gt; &lt;em&gt;Image source: Medium&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It’s Docz. Docz is a popular state-of-the-art open-source tool that allows anyone to create clean and highly customizable custom software documentation sites with fairly minimal effort. Think of it as using Canva to create cool posters. It has got 21.7k stars on &lt;a href="https://github.com/doczjs/docz" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; which is a huge thing in software development. Here are some of the features and cool things about Docz:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built with Gatsby, a hot open-source framework that is used to create blazing fast static sites that are Progressive Web Apps. And no, you don’t need to know Gatsby to use this tool.&lt;/li&gt;
&lt;li&gt;Based on MDX. MDX is Markdown + JSX. Now you don’t need to understand confusing symbols to create markdowns, but just a bunch of easy-to-use JSX-like syntax.&lt;/li&gt;
&lt;li&gt;Supports TypeScript. It provides native TypeScript support. Everyone likes TypeScript. If you don’t, you probably haven’t spent enough time using it, or you haven’t looked at a large codebase because almost all large JavaScript projects are built using TypeScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick Start Guide
&lt;/h3&gt;

&lt;p&gt;Before I show you how to use Docz, if you’ve plenty of time, do read the official docs to get a good overview of this &lt;a href="https://www.docz.site/docs/getting-started" rel="noopener noreferrer"&gt;tool&lt;/a&gt;. If not, keep reading.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add Docz as a dependency in your project. Pick one of the commands below depending on your package manager (npm/yarn). Please take note that react and react-dom versions in your app must be greater than 16.8.0. Otherwise, this will not work so upgrade them. Make sure react and react-dom are installed to run the commands;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;yarn&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="nx"&gt;docz&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="nx"&gt;docz&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Add a .mdx file anywhere in your project, you are not required to adhere to any file architecture or conventions. You can just copy and paste this code.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;---&lt;/span&gt;
&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;
&lt;span class="nx"&gt;route&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;
&lt;span class="o"&gt;---&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Playground&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;docz&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Button&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="err"&gt;#&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Props&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
&lt;span class="err"&gt;##&lt;/span&gt; &lt;span class="nx"&gt;Basic&lt;/span&gt; &lt;span class="nx"&gt;usage&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Playground&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="err"&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;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;submit&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;Click&lt;/span&gt; &lt;span class="nx"&gt;me&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="err"&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="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;No&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;click&lt;/span&gt; &lt;span class="nx"&gt;me&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;/Playground&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;Only a few easy steps are left. Check out the complete &lt;a href="https://aviyel.com/post/1161/this-free-tool-lets-you-create-world-class-documentation-for-react-components" rel="noopener noreferrer"&gt;article&lt;/a&gt; for free on Aviyel. I assure you that this free tool will help you in ways you didn't expect in your software development journey. &lt;/p&gt;

</description>
      <category>react</category>
      <category>documentation</category>
      <category>docz</category>
      <category>software</category>
    </item>
    <item>
      <title>4 Useful React Tricks I Bet You Didn't Know Before (Some Are Too Trivial But Useful)</title>
      <dc:creator>Mohmed Ishak</dc:creator>
      <pubDate>Thu, 30 Sep 2021 07:35:40 +0000</pubDate>
      <link>https://forem.com/ishakmohmed/4-useful-react-tricks-i-bet-you-didn-t-know-before-some-are-too-trivial-but-useful-4om8</link>
      <guid>https://forem.com/ishakmohmed/4-useful-react-tricks-i-bet-you-didn-t-know-before-some-are-too-trivial-but-useful-4om8</guid>
      <description>&lt;p&gt;Hello, React devs! Think you know React? You probably do, but there are a couple of cool tricks only a handful of React devs would know which I'm about to share with you. If any of these tips are new to you, you owe me a like.&lt;/p&gt;

&lt;h3&gt;
  
  
  [1] Use JSX Extension For React Components
&lt;/h3&gt;

&lt;p&gt;To be honest, I don't know if .jsx extension for components make your React app faster, but it certainly helps to differentiate component files and other files in your project directory. Plus, in VS Code, you'll see a React logo beside .jsx files instead of JavaScript logo so you can be assured that you're a React developer at all times.&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%2Fnjtajaw0x6mpoeitlst2.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%2Fnjtajaw0x6mpoeitlst2.PNG" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  [2] Save One Line of Code
&lt;/h3&gt;

&lt;p&gt;Save one line of code by removing the following line because it's unnecessary to import React from React 17 onwards.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="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="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  [3] Modularize Components
&lt;/h3&gt;

&lt;p&gt;So, you have structured your React project well with descriptive files and folders, but what about individual components? I bet they look like the following picture.&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%2Fzlrntfpzmz8t0ptgd312.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%2Fzlrntfpzmz8t0ptgd312.PNG" alt="Mohmed Ishak"&gt;&lt;/a&gt;&lt;br&gt;
The problem is that you're writing your JSX expressions one after another and the codes look like a long, boring article. What you need to do instead is you need to separate groups of related JSX expressions to individual methods and compose those methods together in the return statement (which is responsible for displaying UI on the screen).&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;function&lt;/span&gt; &lt;span class="nf"&gt;Cart&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loadAllProducts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;products&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="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;product&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Card&lt;/span&gt;
            &lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&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;/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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;loadCheckout&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;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Checkout&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&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;/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;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;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;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;loadAllProducts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;products&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;/div&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;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;loadCheckout&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;/div&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;/div&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;/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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See what I did there? Instead of cramming all my JSX expressions after the return keyword, I wrote individual, meaningful methods before the return keyword and composed them afterwards. With this, you can clearly see all the working parts in a component.&lt;/p&gt;

&lt;h3&gt;
  
  
  [4] Weird Hack to Reload Component
&lt;/h3&gt;

&lt;p&gt;There are various ways to reload your component but sometimes, you'll get stuck because you might perceive useState() and useEffect() Hooks to run a certain way and they wouldn't which could leave you frustrated. Thankfully, there's a way to reload your component whenever you want to using the following technique.&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;function&lt;/span&gt; &lt;span class="nf"&gt;Product&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;reload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setReload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// a bunch of codes go here...&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;showRemoveFromCart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;removeFromCart&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="nx"&gt;removeFromCart&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&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;button&lt;/span&gt;
          &lt;span class="nx"&gt;onClick&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="c1"&gt;// remove the product from cart&lt;/span&gt;
            &lt;span class="nf"&gt;setReload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;reload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;Remove&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="nx"&gt;cart&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="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="c1"&gt;// return...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a demo component which isn't fully implemented. Anyway,  you need to pass two arguments just like in this function. In this case, one is reload and another is a function to set the reload value. If it doesn't make sense don't worry, because all you need to do is, whenever you want this component to be re-rendered, use the setReload() method (you can name it anything you want) and flip the value of reload argument just like I did in showRemoveFromCart() method. Your component will refresh immediately. Of course, whichever component that consumes this component must have state variable + method to set that variable from useState() Hook which will be passed down to this component.&lt;/p&gt;

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