<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Muvinai</title>
    <description>The latest articles on DEV Community by Muvinai (@muvinai).</description>
    <link>https://dev.to/muvinai</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%2Forganization%2Fprofile_image%2F5326%2F3082f051-672a-419d-9b33-97a4d1d20f0e.png</url>
      <title>DEV Community: Muvinai</title>
      <link>https://dev.to/muvinai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muvinai"/>
    <language>en</language>
    <item>
      <title>Getting Started with AWS Elastic Beanstalk: A Step-by-Step Guide</title>
      <dc:creator>Rocio Jacob</dc:creator>
      <pubDate>Fri, 19 May 2023 09:49:09 +0000</pubDate>
      <link>https://dev.to/muvinai/getting-started-with-aws-elastic-beanstalk-a-step-by-step-guide-4o4a</link>
      <guid>https://dev.to/muvinai/getting-started-with-aws-elastic-beanstalk-a-step-by-step-guide-4o4a</guid>
      <description>&lt;p&gt;In today's rapidly evolving world of web development, deploying and managing applications in the cloud has become a crucial aspect of every project. AWS Elastic Beanstalk simplifies the process by providing a platform-as-a-service (PaaS) solution that streamlines the deployment and management of your applications. In this tutorial, we will walk you through the step-by-step process of setting up a project in AWS Elastic Beanstalk.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Sign in to the AWS Management Console
&lt;/h3&gt;

&lt;p&gt;To begin, log in to the AWS Management Console using your AWS account credentials. If you don't have an AWS account, you can sign up for one easily on the AWS website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_7fVQ5m0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6jcce5orx5whacv03q0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_7fVQ5m0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6jcce5orx5whacv03q0.png" alt="AWS Console" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Navigate to Elastic Beanstalk
&lt;/h3&gt;

&lt;p&gt;Once you're logged in, navigate to the Elastic Beanstalk service. You can find it by searching for "Elastic Beanstalk" in the AWS Management Console search bar.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pIE2WHIg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2z8vvneyompb8vfvbasi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pIE2WHIg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2z8vvneyompb8vfvbasi.png" alt="Elastic Beanstalk Service" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Create a New Application
&lt;/h3&gt;

&lt;p&gt;Click on the "Create Application" button to start creating your new application. Provide a meaningful name for your application and optionally enter a description to help identify its purpose.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o4n3kRQQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrrzi57wdvdwlxeuadik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o4n3kRQQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrrzi57wdvdwlxeuadik.png" alt="Create Application" width="800" height="138"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 4: Create an Environment
&lt;/h3&gt;

&lt;p&gt;After creating your application, the next step is to set up an environment where your application will run. Click on the "Create environment" button.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Configure the Environment
&lt;/h3&gt;

&lt;p&gt;Choose the environment type that suits your project, such as a Web Server Environment or a Worker Environment. Provide a unique name for your environment and specify the URL that users will access your application from.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Select the Platform
&lt;/h3&gt;

&lt;p&gt;Choose the platform that matches your project's technology stack. Elastic Beanstalk supports a wide range of platforms, including Java, Node.js, Python, Ruby, PHP, and more. Select the platform that best suits your application.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: Customize Additional Settings
&lt;/h3&gt;

&lt;p&gt;Take advantage of the additional settings to fine-tune your environment. Customize the platform version, database configuration, security settings, and environment variables as needed to meet your application's specific requirements.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 8: Review and Create the Environment
&lt;/h3&gt;

&lt;p&gt;Review all the configuration details you have provided and ensure everything is correct. Once you are satisfied, click on the "Create environment" button to start the deployment process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 9: Configure Application Code Deployment
&lt;/h3&gt;

&lt;p&gt;Now that your environment is set up, you can configure the deployment of your application code. Choose the desired method: uploading a ZIP file or connecting to a code repository.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 10: Deploy Your Application
&lt;/h3&gt;

&lt;p&gt;With your environment and code deployment configured, you are ready to deploy your application. Elastic Beanstalk will create the necessary resources and deploy your application code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 11: Access Your Application
&lt;/h3&gt;

&lt;p&gt;Once the deployment is complete, you can access your application by visiting the URL provided in the Elastic Beanstalk environment dashboard. Congratulations! Your application is up and running in Elastic Beanstalk.&lt;/p&gt;

&lt;p&gt;AWS Elastic Beanstalk simplifies the process of deploying and managing applications in the cloud. By following the steps outlined in this tutorial, you have learned how to create an application, set up an environment, configure instance and capacity settings, customize additional configurations, and deploy your application code. Elastic Beanstalk handles the underlying infrastructure, allowing you to focus on your application development. Embrace the power of Elastic Beanstalk and enjoy the seamless experience of deploying your applications in the cloud.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>elasticbeanstalk</category>
      <category>hosting</category>
      <category>howto</category>
    </item>
    <item>
      <title>Building and distributing Vite.js projects with Amplify</title>
      <dc:creator>Rocio Jacob</dc:creator>
      <pubDate>Tue, 04 Oct 2022 14:20:09 +0000</pubDate>
      <link>https://dev.to/muvinai/building-and-distributing-vitejs-projects-with-amplify-hdd</link>
      <guid>https://dev.to/muvinai/building-and-distributing-vitejs-projects-with-amplify-hdd</guid>
      <description>&lt;p&gt;On our last project we decided to use &lt;a href="https://vitejs.dev/" rel="noopener noreferrer"&gt;vite.js&lt;/a&gt;. We can now claim we &lt;strong&gt;LOVED IT&lt;/strong&gt;! We loved vite's speed regarding serving our file and found it extremely intuitive and right for the project.&lt;/p&gt;

&lt;p&gt;Yet development with vite implied quite a problem regarding our hosting on the web app. The fact vite is module based and has css code splitting, made the hosting of the project tough. &lt;/p&gt;

&lt;p&gt;When we first started hosting it on amplify, we had the issue that the enviroment was completely blank, and none of the page contents were fetched by the service. &lt;/p&gt;

&lt;p&gt;We fixed the initial problem by using the redirect AWS suggests for SPA's:&lt;br&gt;
&lt;code&gt;&amp;lt;/^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Beware with this redirect link as it's position on teh rewrites and redirects can affect the performance of the page.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So our rewrites and redirects page ended up looking like this:&lt;/p&gt;

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

&lt;p&gt;Then we had to adapt the build settings so that the &lt;code&gt;dist&lt;/code&gt; folder vite creates can be found by amplify:&lt;/p&gt;

&lt;p&gt;Our build file ended up looking like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="na"&gt;frontend&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;phases&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;preBuild&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;commands&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm ci&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;commands&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm run build --prod&lt;/span&gt;
  &lt;span class="na"&gt;artifacts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="c1"&gt;# IMPORTANT - Please verify your build output directory&lt;/span&gt;
    &lt;span class="na"&gt;baseDirectory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dist&lt;/span&gt;
    &lt;span class="na"&gt;files&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;**/*'&lt;/span&gt;
  &lt;span class="na"&gt;cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;paths&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;node_modules/**/*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After following this steps, we could host the webpage correctly, yet amplify still had arbitrary issues on fetching some webpages. For example redirects were not working and took us to a blank page that claimed Amplify CloudFrontURL couldn't find the page. &lt;/p&gt;

&lt;p&gt;Apparently some fractions of the code weren't being found. This is the problem that held us days, and to which we struggled to find the solution. The thing was, we had to change some things in &lt;code&gt;vite.config.js&lt;/code&gt; that were making the base of the project untraceable to amplify.&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;vite.config.js&lt;/code&gt; ended up looking like this. Adding &lt;code&gt;base: './index.html'&lt;/code&gt; was what managed to fix the mistake of arbitrary 404 we had:&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;defineConfig&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;vite&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;react&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;@vitejs/plugin-react&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;mkcert&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;vite-plugin-mkcert&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;server&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;react&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nf"&gt;mkcert&lt;/span&gt;&lt;span class="p"&gt;()],&lt;/span&gt;
  &lt;span class="na"&gt;base&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./index.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./index.html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// default&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;alias&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="s1"&gt;./runtimeConfig&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="s1"&gt;./runtimeConfig.browser&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We hope this solution helps someone struggling with the same problem. &lt;/p&gt;

</description>
      <category>vite</category>
      <category>amplify</category>
      <category>aws</category>
    </item>
    <item>
      <title>Create a Landing Page that converts</title>
      <dc:creator>Luisina Comes</dc:creator>
      <pubDate>Thu, 28 Apr 2022 14:51:59 +0000</pubDate>
      <link>https://dev.to/muvinai/create-a-landing-page-that-converts-3mc0</link>
      <guid>https://dev.to/muvinai/create-a-landing-page-that-converts-3mc0</guid>
      <description>&lt;p&gt;These are the best landing page practices we’ve learned through the years:&lt;/p&gt;

&lt;p&gt;To start with, divide your page into two sections: above the fold and below the fold. In the first one, make sure you earn the customer’s attention. You can use the second one to provide extra information, clear doubts and earn the sale. &lt;/p&gt;

&lt;p&gt;When planning the above the fold section of your landing page, keep in mind that less is more. Focus exclusively on showcasing the value you provide and explaining how you’ll create it. This should be achieved briefly with a title, a subtitle, social proof, a CTA and a few visuals. &lt;/p&gt;

&lt;p&gt;These five elements are key, dedicate time to perfect them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Title&lt;/strong&gt;: sum up the value you offer in a few words. Think about the title of your landing page as a unique label for your brand. It should explain what you do and highlight what makes your offer outstanding.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Subtitle&lt;/strong&gt;: this section allows you to address the user’s main objection. To ace this, you’ll need to get to know your audience and anticipate their concerns about your offer.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Visuals&lt;/strong&gt;: show your potential customers your value. Try to avoid stock images, they will hardly highlight the uniqueness of what you offer. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Social proof&lt;/strong&gt;: user’s reviews support your value proposition.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CTA&lt;/strong&gt;: encourage the user to take action!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If done correctly, the above the fold section of your landing page should clearly state what you are offering and get people’s attention so that they scroll down to get more information. &lt;/p&gt;

&lt;p&gt;Below the fold, you’ll need to show the value that you promised. Moreover, this section gives you more room to deal with your customers’ objections and doubts. Make sure you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Clear doubts you think they’ll have.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Describe the main features of your product/service.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add social proof.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add another CTA.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Add storytelling: finish your landing page with a personal touch. Briefly describe how you feel about what you are offering and how you are helping people with it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s important that you don’t add anything that drives people away from your page. If a user arrives at your landing page and scrolls down, your job is to keep them there. Don’t add anything that redirects them to other pages.&lt;/p&gt;

&lt;p&gt;Follow these easy steps and create a landing page that converts! Remember that a cluttered page will only distract and confuse your visitor. It’s best to have fewer elements, you just have to take the time to make them count. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Consider these factors before advertising on TikTok</title>
      <dc:creator>Luisina Comes</dc:creator>
      <pubDate>Thu, 31 Mar 2022 21:16:30 +0000</pubDate>
      <link>https://dev.to/muvinai/consider-these-factors-before-advertising-on-tiktok-55j0</link>
      <guid>https://dev.to/muvinai/consider-these-factors-before-advertising-on-tiktok-55j0</guid>
      <description>&lt;p&gt;TikTok surpassed &lt;strong&gt;1 billion users&lt;/strong&gt; in September. The platform is unsaturated and traffic is affordable, which makes it a tempting channel for marketers all over the world. &lt;/p&gt;

&lt;p&gt;It almost seems too good to be true. But there are several factors to take into account. Make sure you read this before you jump into TikTok Ads!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Testing a new channel is expensive. Are you willing to divert 20% of your advertising budget towards TikTok? This is the minimum we recommend. After all, the only way to know if the platform works for you is to spend real money on it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Do you have the time? Running ads for a few weeks won’t give you any substantial data. As a rule of thumb, give it at least two months before you make up your mind.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Have you tried other short-video channels like Instagram stories or IGTV? If so, have you had any success? TikTok can have cheaper CPAs, cheaper CPMs, and higher quality traffic than Instagram. But transferring the same content from one channel to the other won’t work. You can reuse Instagram content and try your luck, but our advice is to make new, &lt;strong&gt;platform-specific videos&lt;/strong&gt;. It’s key to focus on the &lt;strong&gt;content&lt;/strong&gt; rather than the video’s look and aesthetic.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If these facts make TikTok ads seem unappealing to you, try an organic strategy first. Upload two videos per week for two months and see how they perform for themselves. This will give you time to get to know the platform and identify the content your audience likes best. &lt;/p&gt;

&lt;p&gt;We are not trying to get you to ditch TikTok Ads, but we know it’s a tricky channel to get a hold of. Simply make sure you have the resources needed to give it a try and remember: &lt;strong&gt;TikTok is not Instagram!&lt;/strong&gt; &lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to build a successful Shopify store</title>
      <dc:creator>Luisina Comes</dc:creator>
      <pubDate>Tue, 15 Mar 2022 20:47:51 +0000</pubDate>
      <link>https://dev.to/muvinai/how-to-launch-a-successful-shopify-store-4k3i</link>
      <guid>https://dev.to/muvinai/how-to-launch-a-successful-shopify-store-4k3i</guid>
      <description>&lt;p&gt;We've created tons of online stores for our clients, and most of them are built on Shopify. Learn why we love it so much and how easy it is to launch a Shopify store that converts!&lt;/p&gt;

&lt;h3&gt;
  
  
  Why we love it
&lt;/h3&gt;

&lt;p&gt;Unlike many popular e-commerce platforms, Shopify gives merchants the possibility to customize almost everything in their site to present their brand accurately.&lt;/p&gt;

&lt;p&gt;It offers a clean, user-friendly interface and allows you to replace most custom-development functionalities with third-party apps that integrate easily.&lt;/p&gt;

&lt;p&gt;On top of that, it provides essential insights into your customer base, which is key to learn how your clients navigate through your store and keep it optimized!&lt;/p&gt;

&lt;h3&gt;
  
  
  Set up a conversion-centered online store
&lt;/h3&gt;

&lt;p&gt;The first step is to decide whether you’ll use a &lt;strong&gt;Shopify theme&lt;/strong&gt; or not. Unless your business has really specific needs, we recommend you do. There are lots of different options to choose from, and the key is they are specifically built to convert.&lt;/p&gt;

&lt;p&gt;The theme you choose will affect your store’s aesthetics and user experience, so it can be a bit overwhelming to pick one. A great tip is to use &lt;a href="https://builtwith.com"&gt;BuiltWith&lt;/a&gt; to see which themes your favourite Shopify stores use.&lt;/p&gt;

&lt;p&gt;Consider the main features you want for your site and make sure the theme you choose has them all. Once you’ve made a decision you’ll need to think about how you want to display your content throughout the store.&lt;/p&gt;

&lt;p&gt;When designing your &lt;strong&gt;homepage&lt;/strong&gt;, always keep in mind the difference between above the fold (before scrolling) and below the fold (after scrolling). The first section is meant to feature pictures and CTAs. Don’t include extra information, keep the copy short. Any additional details will go below the fold, where you can add reviews, blogs and important categories like best sellers.&lt;/p&gt;

&lt;p&gt;Once you’ve established a straightforward homepage, you can build the &lt;strong&gt;product pages&lt;/strong&gt;. These should draw attention to your product photos and the “add to cart” button. Don’t get creative here, you’ll risk drawing people away.&lt;/p&gt;

&lt;p&gt;The same goes for the &lt;strong&gt;checkout page&lt;/strong&gt;: make sure there are no distractions or exits that would stir your customers away from their purchase.&lt;/p&gt;

&lt;h3&gt;
  
  
  Closing remarks
&lt;/h3&gt;

&lt;p&gt;Always keep in mind that the main goal of a Shopify store is to generate conversions. Leave unnecessary information apart and avoid busy elements like animations, they will only reduce the speed of your site and drive clients away. Instead, focus on your products and CTAs.&lt;/p&gt;

&lt;p&gt;Follow these basic tips to get the most conversions!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a React Native Filter - Part 1</title>
      <dc:creator>Rocio Jacob</dc:creator>
      <pubDate>Thu, 17 Feb 2022 18:08:39 +0000</pubDate>
      <link>https://dev.to/muvinai/building-a-react-native-filter-part-1-21j7</link>
      <guid>https://dev.to/muvinai/building-a-react-native-filter-part-1-21j7</guid>
      <description>&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%2Fjxwau6dlwf85sch0wfpj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjxwau6dlwf85sch0wfpj.gif" alt="App Walkthrough"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A couple of weeks ago a client asked us to create an application that displayed all of it's stores. The app had to be built in &lt;strong&gt;React Native&lt;/strong&gt; in order to speed up development time and ensure compatibility among Android and IOS and had to include a full list of our client's stores. This list was fetched from a MongoDB collection, and came as an array of objects containing information for each store (such as location, phone number, email, coordinates). Obviously, a plain list of objects doesn't satisfy a customer, as scrolling through a 189 store list to find a specific one might be extremely painful. So with React Native (our choice to build fast compatible apps) we decided to create a filter. The filter we built included features such as &lt;strong&gt;searching, categorizing and ordering according to proximity&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;In this article, we will show you how the filter was built by using a &lt;u&gt;mock API&lt;/u&gt; to build a filter with search and categorization (in the future we will write another article to show how to handle location based objects, order them and filter them). The tutorial will not cover a step by step of the whole code, but will go through the most important parts when building it. You can find the whole code in &lt;strong&gt;this&lt;/strong&gt; &lt;a href="https://snack.expo.dev/@rochi/react-native-filter" rel="noopener noreferrer"&gt;&lt;strong&gt;Expo Snack&lt;/strong&gt;&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;You will see this is a &lt;strong&gt;front-end built filter&lt;/strong&gt;, and doesn't use backend filtering. Although backend filtering is a good option (particularly to handle long lists), it works smoothly with the data we have. &lt;strong&gt;Bear in mind&lt;/strong&gt; if you have millions of elements mapping through them will impact negatively on the app's performance. &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%2Ft1j9ahi8xjcgi6h4vyd6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft1j9ahi8xjcgi6h4vyd6.jpg" alt="Main view of our application"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, to start we will be using &lt;a href="https://www.fruityvice.com/" rel="noopener noreferrer"&gt;Fruityvice's API&lt;/a&gt; that will bring a response with an array of objects containing different information about fruits. An example for the response we get is:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"genus"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Malus"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Apple"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"family"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Rosaceae"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"order"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Rosales"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"nutritions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"carbohydrates"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;11.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"protein"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"fat"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;0.4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"calories"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"sugar"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;10.3&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;Let's get hands on it to the real code. The structure our project will take is: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A main App.js file where most of the work will happen, here we will set the main states and fetch our data. &lt;/li&gt;
&lt;li&gt;Components folder.&lt;/li&gt;
&lt;li&gt;Assets folder.&lt;/li&gt;
&lt;li&gt;Data folder in order to save the initial state some variables will have.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;
  
  
  Fetching the API
&lt;/h2&gt;

&lt;p&gt;The first thing we should do, is fetch the API. We fetch it through a simple &lt;strong&gt;fetch function built in a useEffect&lt;/strong&gt;, meaning each time the component mounts, the API is fetched and the fruits "refresh". The response is saved as a json and we can now work with it.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

  &lt;span class="nf"&gt;useEffect&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://www.fruityvice.com/api/fruit/all&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="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;response&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;response&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="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setFruits&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;json&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;error&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;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;error&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;finally&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setLoading&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="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;


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

&lt;/div&gt;
&lt;h2&gt;
  
  
  Our App.js Component
&lt;/h2&gt;

&lt;p&gt;We create a &lt;code&gt;&amp;lt;SafeAreaView /&amp;gt;&lt;/code&gt; for our App.js (so that the content we build is contained within a visible space). Inside the SafeAreaView we will have three components, the &lt;strong&gt;AppBar&lt;/strong&gt; (that will hold the modal and a logo for our app), the &lt;strong&gt;modal&lt;/strong&gt; itself, and the &lt;strong&gt;Wrapper&lt;/strong&gt; (called &lt;code&gt;&amp;lt;FruitsWrapper /&amp;gt;&lt;/code&gt;) where we will render the "card-styled" list of fruits with their information.&lt;/p&gt;

&lt;p&gt;On the App.js we'll also do two things that will help us handle the Filtering correctly. &lt;/p&gt;

&lt;p&gt;First we'll set a couple of states:&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setFruits&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&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;filter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setFilter&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialFilter&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;intermediateFilter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setIntermediateFilter&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialFilter&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;modalVisible&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setModalVisible&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;fruits&lt;/em&gt; holds the array of objects we fetch from the API&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;filter&lt;/em&gt; filter is the real filter that will be applied when the user decides to APPLY the filter within the modal&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;intermediateFilter&lt;/em&gt; is a filter that is setted while the user interacts with the modal, once the apply button is pressed, the intermediateFilter becomes the actual filter&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;modalVisible&lt;/em&gt; will handle modal visibility &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Why the intermediateFilter?&lt;/em&gt;&lt;/strong&gt; the intermediate filter ensures the fields the user clicks while in the modal will be applied correctly. We need to save the user choices as he/she advances through the modal.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Both the intermediateFilter and the filter take up an &lt;em&gt;&lt;strong&gt;initialFilter&lt;/strong&gt;&lt;/em&gt;. What is this? The &lt;code&gt;initialFilter&lt;/code&gt; is a js written in our data folder. initialFilter is an object that hold's the initial state of the fields we are going to filter.&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;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initialFilter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;query&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;genus&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;carbohydrates&lt;/span&gt;&lt;span class="p"&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;h2&gt;
  
  
  The AppBar
&lt;/h2&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%2F5c4sy0vuoolxtg74j6j7.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5c4sy0vuoolxtg74j6j7.jpg" alt="App Bar"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The App bar is extremely simple. We have a logo, and a button that when pressed will change the state of the &lt;code&gt;modalVisible&lt;/code&gt; variable to true and show us the modal. &lt;/p&gt;
&lt;h2&gt;
  
  
  Displaying the info
&lt;/h2&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%2Fshfihowh8uwc2kkcevvn.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fshfihowh8uwc2kkcevvn.jpg" alt="sample of "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before we filter we want to display multiple cards containing information about the fruits so we can then sort them according to the user's choices. For this we have two components &lt;code&gt;&amp;lt;FruitsWrapper /&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;InfoCard/&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;FruitsWrapper /&amp;gt;&lt;/code&gt; is the wrapper where we map through the fruits and display them. In this Wrapper we will also have the &lt;u&gt;filtering instance&lt;/u&gt;. So as long as there no filters it will display the complete object we receive from the fetch. If there filters, we will push fruits to a new variable that will be empty. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;&amp;lt;InfoCard/&amp;gt;&lt;/code&gt; is the UI of the card that will hold the object's info. We build only one object, and then map the fetch response and render each fruit (with it's information in the cards).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  The &lt;code&gt;&amp;lt;FruitsWrapper /&amp;gt;&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This component is &lt;strong&gt;SUPER&lt;/strong&gt; important. As the logic applied here makes the magic to display the filtered content. &lt;/p&gt;

&lt;p&gt;You can see that at the beginning of the component I declared two boolean variables: &lt;code&gt;filterFruits&lt;/code&gt; and &lt;code&gt;empty&lt;/code&gt; (empty will not be used yet, but will serve us to display that no fruits were fetched). I then set up an &lt;strong&gt;empty filterArray&lt;/strong&gt; where the fruits I filter with my modal will be pushed. After doing this I set &lt;code&gt;filterFruits&lt;/code&gt; equal to &lt;code&gt;allFruits&lt;/code&gt;, the later one being the whole fruit array we brought on the first place. The following logic is key to filtering:&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;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;filterFruits&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;filterFruits&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
    &lt;span class="nx"&gt;filterFruits&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;fruit&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;// I have two things, the filter and the fruits genus (in the array) so if I filter I only want to show the ones that match the genus&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;genus&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;genus&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;genus&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="nx"&gt;filterArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="p"&gt;})&lt;/span&gt;
        &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;filterArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;filterFruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;filterArray&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;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;filterFruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="nx"&gt;empty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The filtering happens if &lt;code&gt;filterFruits&lt;/code&gt; (before known as allFruits) is &lt;strong&gt;not undefined&lt;/strong&gt; (meaning it has some content) and the &lt;strong&gt;type of this is an object&lt;/strong&gt;. What we do is map through each fruit, if it &lt;u&gt;doesn't match&lt;/u&gt; the parameters we want it to, we &lt;strong&gt;return&lt;/strong&gt;, else we &lt;strong&gt;push it&lt;/strong&gt; to the &lt;code&gt;filterArray&lt;/code&gt;. If the filter array is bigger than 0 (meaning fruits were pushed) &lt;code&gt;filterArray&lt;/code&gt; (the one where we pushed) becomes &lt;code&gt;filterFruits&lt;/code&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  The Modal
&lt;/h2&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%2Flcqr48pwfdpktsco7kl5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flcqr48pwfdpktsco7kl5.jpg" alt="An image of the App's modal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The modal is the most important part of this tutorial. For this we will use &lt;strong&gt;React Native's built in modal&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In the application we built for the client we had two modal instances, the &lt;em&gt;filtering modal&lt;/em&gt; (that used the native modal) and an &lt;em&gt;alert modal&lt;/em&gt; (where we used &lt;a href="https://akveo.github.io/react-native-ui-kitten/" rel="noopener noreferrer"&gt;UI Kitten's&lt;/a&gt; modal). We like the native modal because it offers us the possibility of deciding how it transitions and it's easier to set it up fullscreen. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As we mentioned previously we chose to use an &lt;strong&gt;intermediate filter within the modal&lt;/strong&gt; so that the state management can be smooth, and we can access the different states (Remember that the &lt;code&gt;initalFilter&lt;/code&gt; was an object?). Yet, after the user click's the apply button, we want the &lt;code&gt;intermediateFilter&lt;/code&gt; to become the actual &lt;code&gt;filter&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A key thing we also have in this modal is the list of all the genus. Instead of mapping all the fruits and displaying the genus, in the App.js we created an array with &lt;strong&gt;all the unique genus&lt;/strong&gt; (so that we don't get them repeated). The following code creates an array of all the fruit.genus unique values:&lt;/p&gt;

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

const genusResult = allFruits.map(item =&amp;gt; item.genus)
  .filter((value, index, self) =&amp;gt; self.indexOf(value) === index)


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

&lt;/div&gt;

&lt;p&gt;We loop through this array that we built to create the radio buttons, as you will see in the &lt;code&gt;RadioButton.js&lt;/code&gt; file. This file holds custom built Radio Buttons. The good thing about this is that they are fully customizable, and give us more control over the user selection. &lt;/p&gt;

&lt;p&gt;The thing is, the user can only select one genus, and when the user selects the genus selected is saved in the intermediate filter. Once the user decides which genus he/she wants to see, he applies the filter and because of the logic applied in the &lt;code&gt;&amp;lt;FruitsWrapper /&amp;gt;&lt;/code&gt; only the fruits that have that genus will be shown. &lt;/p&gt;

&lt;h2&gt;
  
  
  Closing Remarks
&lt;/h2&gt;

&lt;p&gt;This was a quick tutorial over how to build the filter. We hope it was easy to follow and in the second part we will talk about querying filtering. &lt;/p&gt;

&lt;p&gt;Remember the full code is in our &lt;a href="https://snack.expo.dev/@rochi/react-native-filter" rel="noopener noreferrer"&gt;Expo Snack&lt;/a&gt;&lt;/p&gt;

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