<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sumit Kumar on Medium]]></title>
        <description><![CDATA[Stories by Sumit Kumar on Medium]]></description>
        <link>https://medium.com/@sumitthrita.dev?source=rss-d46e263d7c3c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*AqBjGbFwoEv_5g9E</url>
            <title>Stories by Sumit Kumar on Medium</title>
            <link>https://medium.com/@sumitthrita.dev?source=rss-d46e263d7c3c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 05:39:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sumitthrita.dev/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Ultimate Guide to Developing and Deploying a React Native App with Expo]]></title>
            <link>https://medium.com/@sumitthrita.dev/the-ultimate-guide-to-developing-and-deploying-a-react-native-app-with-expo-b9766b02eec2?source=rss-d46e263d7c3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9766b02eec2</guid>
            <category><![CDATA[expo]]></category>
            <category><![CDATA[react-native-development]]></category>
            <category><![CDATA[react-native]]></category>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Thu, 06 Mar 2025 06:50:10 GMT</pubDate>
            <atom:updated>2025-03-06T06:50:10.010Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome! In this journey, we’ll walk through the complete process of building a React Native application from scratch. We’ll start by setting up the development environment, creating a development build, and testing it on a local system or mobile device. Then, we’ll generate a production-ready build for Android and test it thoroughly. Finally, we’ll take the last step — deploying the app to the Google Play Store. Let’s get started! 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uB458ookbr_3J5agDDdagg.jpeg" /><figcaption>Image by <a href="https://www.freepik.com/free-vector/mobile-wireframe-concept-illustration_12781056.htm#fromView=search&amp;page=1&amp;position=10&amp;uuid=c1da0e1e-d3f9-42d1-8a93-777353e3b5d6&amp;query=react+native+app">Storyset</a> on Freepik</figcaption></figure><h3>Creating a React Native App</h3><p>When starting a React Native project, we have two main approaches:</p><ol><li><strong>Using Expo</strong> — Recommended for beginners as it simplifies setup and development. We’ll discuss about expo later in this blog.</li><li><strong>Using React Native CLI</strong> — Offers more customization but requires additional configuration.</li></ol><p>For this guide, we’ll use <strong>Expo</strong> to create our app, as it provides a smoother development experience.</p><h4>Step 1: Install Expo CLI</h4><p>If you haven’t installed Expo globally yet, run the following command:</p><pre>npm install -g expo-cli</pre><h4>Step 2: Create a New Expo Project</h4><p>Now, let’s create our project. Replace MyApp with your desired project name from following command.</p><pre>npx create-expo-app MyApp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*xQQ1mDaN0omrzTxhtcWtQg.png" /></figure><p>Select “yes” to proceed.</p><p>Once the setup is complete, navigate to the project folder and start your development journey! 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*jVBrbS2RXjinamggd-IaIA.png" /></figure><p>If you encounter an error during the npm install process, don’t worry! We’ll resolve it shortly by installing dependencies separately using either Yarn or npm after updating npm version.</p><p>Now, let’s install the dependencies using Yarn. Simply run the following command:</p><pre>yarn install<br>// or <br>yarn</pre><h3>Checking Real-Time Changes in Your React Native App</h3><p>When developing a React Native app, there are multiple ways to test changes in real time. However, <strong>Expo</strong> makes this process incredibly simple and efficient and made our life happy.</p><h4>What is Expo and Why is it Helpful?</h4><p><strong>Expo</strong> is an open-source framework that simplifies React Native development by providing a set of tools and services. It eliminates the need for complex native configurations, making it ideal for both beginners and experienced developers. With Expo, you can:</p><p>✅ Quickly set up and run your app without worrying about native dependencies.<br>✅ Use the <strong>Expo Go</strong> app to preview changes on your mobile device in real time.<br>✅ Seamlessly create both <strong>development</strong> and <strong>deployment</strong> builds with <strong>EAS (Expo Application Services)</strong>.<br>✅ Test your app on a physical device, simulator, or even in a web browser.</p><h3>Ways to Test Your App in Real Time</h3><ol><li><strong>Running Locally</strong> — You can start the development server and preview your app in a web browser. With dev tools, you can inspect and switch to a mobile screen layout.</li><li><strong>Using the Expo Go App</strong> — Install the <strong>Expo Go</strong> app from the Play Store or App Store. Start your project and either scan the provided QR code or open the link directly to load your app instantly.</li><li><strong>Testing on a Simulator/Emulator</strong> — You can run your app on an Android Emulator or iOS Simulator to test different screen sizes and device behaviors.</li></ol><p>💡 <strong>Don’t worry! We’ll explore each of these methods step by step in this guide.</strong> 🚀</p><h3>Running and Testing locally on browser</h3><p>Now navigate to your project directory and run the following command to start your app:</p><pre>npx expo start<br>// or<br>npm start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*wTfz-e60gpWurXtQQgSrsA.png" /></figure><p>Next, open your browser and visit the web link provided in the terminal (as shown in the image above).</p><p>Open the browser’s Developer Tools, inspect the tab, and switch to the mobile view.</p><p><strong>Congratulations! 🎉 Your app is now running on your laptop browser and will reflect changes in real-time as you update your code.</strong></p><p>Now before discussing about other ways first we should learn about how to create development builds using <strong>EAS</strong>.</p><h3>Creating a development build (apk file) using EAS</h3><p>Now, we will create a <strong>development build</strong> using <strong>EAS (Expo Application Services)</strong>, which allows us to test our app on a real device in real time. Follow these steps:</p><h4>Step 1: Install EAS CLI Globally</h4><p>You can install EAS CLI using either <strong>Yarn</strong> or <strong>npm</strong>:</p><pre>yarn global add eas-cli</pre><p>or</p><pre>npm install -g eas-cli</pre><h4>Step 2: Verify EAS Installation</h4><p>Once installed, check the EAS version to confirm the installation:</p><pre>eas --version</pre><p>This ensures that EAS is correctly installed and ready to use. 🚀</p><h4>Step 3: Create and Login to your EXPO Account</h4><p>To use <strong>EAS (Expo Application Services)</strong> for building and deploying your app, you need an Expo account.</p><ol><li><strong>Create an Expo Account</strong> — If you don’t already have one, sign up at <a href="https://expo.dev/">Expo’s official website</a>.</li><li><strong>Log in to Expo via CLI</strong> — Run the following command and enter your <strong>username/email</strong> and <strong>password</strong> when prompted:</li></ol><pre>eas login</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*gluOhwlEr7fv7Xt-Wcdqwg.png" /></figure><p>Once logged in, you’ll be able to use EAS to create and manage builds for your app. 🚀</p><h4>Step 4: Creating a Development Build</h4><p>To generate a <strong>development build</strong> for the Android platform, navigate to your project and run the following command:</p><pre>eas build --profile development --platform android<br></pre><p>Since this is your first build, <strong>EAS</strong> will prompt you to install <strong>expo-dev-client</strong>.</p><p>✅ <strong>Type “yes” and press Enter</strong> to proceed with the installation.</p><p>This package is essential for running development builds efficiently. 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*Yd2MMXSschtVVvbU70-vtA.png" /></figure><p>Now, EAS will prompt you to automatically create an <strong>EAS project</strong> with a default name as shown in image below.</p><p>✅ <strong>You can either accept the default name or enter a custom project name.</strong><br>✅ <strong>Once done, choose “Yes” to proceed.</strong></p><p>This will set up your project for future EAS builds seamlessly. 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*ZQ7OnPhXXa23VHyEtlMbvg.png" /></figure><p>During the build process, the prompt will ask you to create an <strong>Android Application ID</strong> with a default value as shown in image above.</p><p>✅ <strong>You can either accept the default ID or enter a custom one.</strong><br>✅ <strong>Press “Enter” to proceed.</strong></p><p>This ID is essential for identifying your app on the Google Play Store. 🚀</p><p>Now, again during the build process, <strong>EAS</strong> will prompt you to generate a new <strong>Android Keystore </strong>as shown in the image below.</p><p>✅ <strong>Type “yes” and press Enter</strong> to allow EAS to create one for you.</p><p>This Keystore is required for signing your app before publishing it to the <strong>Google Play Store</strong>. 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*7c_XG7nODJJxjNypZMBrTQ.png" /></figure><p>✅ Your <strong>build is now in queue</strong> and will start shortly. 🚀<br>You can monitor the progress in the terminal or on the <strong>Expo Dashboard</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*BubafrTT2ciN_TVQQEA6dQ.png" /></figure><p>🚀 <strong>Congrats! </strong>Your build is in progress, wait for its completion.</p><p>Once completed, you’ll receive a download link for your <strong>APK file </strong>as show below in image, ready for testing! 🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*jAYCG538KkzjVxaOAflkQA.png" /></figure><p>After the process, you will be prompted to <strong>install and run the Android build on an emulator</strong>.</p><p>✅ <strong>Type “No” and press Enter</strong> to skip this step for now.<br>📌 We will cover this in detail later in the blog.</p><p>Your build will continue as expected! 🚀</p><p>🎉 <strong>Well done!</strong> You have successfully created a development build for your project. Now, you can install the APK on your Android device and test your changes in real-time. 🚀</p><h3>Running Using Expo Go App</h3><p>Go to the Play Store and install the <strong>Expo Go</strong> app on your mobile device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wlJp8i5G5lvLsFanI9DWkA.png" /></figure><ol><li><strong>Install the Development Build</strong> — Transfer the APK file (generated in the last step) to your Android device and install it.</li><li><strong>Open Your App</strong> — Once installed, launch the app on your mobile device.</li><li><strong>Restart Your Project</strong> — Now, restart your development server by running:</li></ol><pre>npx expo start</pre><p>or</p><pre>npm start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*4PJYA4gumdUaSalFtf8yKA.png" /></figure><p>Now, you can launch your app by doing one of the following:</p><p>✅ <strong>Scan the QR Code</strong> — Use your phone’s camera to scan the QR code provided in the terminal.<br>✅ <strong>Manually Enter the Link</strong> — Open the <strong>Expo Go</strong> app and enter the link displayed below the QR code (e.g., exp://192.168.29.116:8081).<br>✅ <strong>Use the Development Build</strong> – Open the development app you installed and enter the same link.</p><p>🎉 <strong>Your app is now running on your Android device, and you can test changes in real-time!</strong> 🚀</p><p>⚠️ <strong>Note:</strong> If you install any new dependencies, you’ll need to restart the app for the changes to take effect.</p><h3>Testing on Simulator or Emulator</h3><p>Before creating a development build, we will install <strong>Android Studio</strong> as we want to test our build on an <strong>Android Emulator</strong> instead of a physical device.</p><p>👉 <strong>Download and install Android Studio</strong> from the official website: <a href="https://developer.android.com/studio">Android Studio Download</a>.</p><p>Now create development build by running following command:</p><pre>eas build --profile development --platform android</pre><p>🎉 <strong>Great job!</strong> You’ve successfully started the development build process. Once the build process is complete, the terminal will prompt you with an option to <strong>install the build on Android Studio </strong>as shown in image below<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*_JA5W2ckqH_-bPNo5gnq4w.jpeg" /></figure><p>✅ <strong>Click “Yes”</strong> to download and install the development build on your Android emulator as shown in image below. This will download your development build to your simulation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*mpU4kURJ5RkB-vJWM51MVw.png" /></figure><p>This will allow you to test your app directly on the Android Studio virtual device. 🚀</p><p>Now, restart your Expo development server by running the following command:</p><pre>npx expo start</pre><p>This will ensure your app is running and ready for real-time testing. 🚀</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*3yWl7lndL2roDvGtNTRNKg.png" /></figure><p>To open your development build in the Android emulator, type a in the terminal as it is shown in the image above.</p><pre>a</pre><p>(This option is shown in the terminal output.)</p><p>🎉 <strong>Your app will now launch in the emulator, and you can test changes in real-time!</strong> 🚀</p><h3>Next Step: Preparing for Deployment 🚀</h3><p>🎉 <strong>Congratulations!</strong> You have successfully created your React Native app, developed features, and tested it both locally and with a development build. Now, it’s time to take the next big step — <strong>creating a deployment build</strong> and <strong>publishing it on the Google Play Store or Expo</strong>.</p><p>Stay tuned as we guide you through the deployment process! 🚀✨</p><h3>Deploying on Google Play Store (Without Expo)</h3><p>As we’re using React Native CLI, we will follow these steps to generate a release APK for Android.</p><h3>1. Navigate to the Android Folder</h3><p>Make sure you’re in your React Native project directory, then move into the android folder:</p><pre>cd android</pre><h3>2. Generate a Keystore File</h3><p>A <strong>keystore</strong> is required to sign the APK before publishing. You can generate one using the following command:</p><pre>keytool -genkey -v -keystore my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias my-key-alias</pre><ul><li><strong>It will prompt you for information:</strong></li><li><strong>Keystore password</strong> → Remember this, as you’ll need it later.</li><li><strong>First and last name</strong> (Enter your name or app-related name)</li><li><strong>Organizational unit</strong> (Optional)</li><li><strong>Organization name</strong> (Optional)</li><li><strong>City/locality</strong> (Enter your city)</li><li><strong>State/province</strong> (Enter your state)</li><li><strong>Country code</strong> (Two-letter country code, e.g., US for the USA)</li><li>After running this command, a file named <strong>my-release-key.jks</strong> will be created in your current directory.</li></ul><h4>Move Keystore to Your Project</h4><p>Move the keystore file to android/app/ by running:</p><pre>mv my-release-key.jks ../app/</pre><h3>3. Configure Keystore in gradle.properties</h3><p>Open the file android/gradle.properties and add the following lines:</p><pre>MYAPP_UPLOAD_STORE_FILE=my-release-key.jks<br>MYAPP_UPLOAD_KEY_ALIAS=my-key-alias<br>MYAPP_UPLOAD_STORE_PASSWORD=your-keystore-password<br>MYAPP_UPLOAD_KEY_PASSWORD=your-key-password</pre><blockquote><strong><em>Replace </em></strong><strong><em>your-keystore-password and </em></strong><strong><em>your-key-password with the ones you set during keystore creation.</em></strong></blockquote><h3>4. Update android/app/build.gradle</h3><p>Edit android/app/build.gradle and find the signingConfigs section. Modify it like this:</p><pre>android {<br>    ...<br>    signingConfigs {<br>        release {<br>            storeFile file(MYAPP_UPLOAD_STORE_FILE)<br>            storePassword MYAPP_UPLOAD_STORE_PASSWORD<br>            keyAlias MYAPP_UPLOAD_KEY_ALIAS<br>            keyPassword MYAPP_UPLOAD_KEY_PASSWORD<br>        }<br>    }<br>    buildTypes {<br>        release {<br>            signingConfig signingConfigs.release<br>            minifyEnabled true // Enables code shrinking<br>            proguardFiles getDefaultProguardFile(&#39;proguard-android-optimize.txt&#39;), &#39;proguard-rules.pro&#39;<br>        }<br>    }<br>}</pre><h3>5. Generate the APK</h3><p>Now, run the following command from the android/ directory:</p><pre>./gradlew assembleRelease</pre><blockquote><em>If you get a </em><strong><em>permission denied</em></strong><em> error, try:</em></blockquote><pre>chmod +x gradlew<br>./gradlew assembleRelease</pre><h3>6. Locate the APK</h3><p>Once the build completes, your <strong>release APK</strong> will be located at:</p><pre>android/app/build/outputs/apk/release/app-release.apk</pre><blockquote><em>You can now </em><strong><em>transfer this APK to your phone for testing or upload it to the Play Store</em></strong><em>.</em></blockquote><h3>7. Generate an AAB (Recommended for Play Store)</h3><p>Google Play now prefers <strong>AAB (Android App Bundle)</strong> instead of APK. To generate an AAB, run:</p><pre>./gradlew bundleRelease</pre><p>The <strong>AAB file</strong> will be located at:</p><pre>android/app/build/outputs/bundle/release/app-release.aab</pre><h3>Next Steps</h3><ol><li><strong>Test the APK on a device</strong> — Copy the .apk file to your phone and install it.</li><li><strong>Upload AAB to Play Console</strong> — Use <strong>Google Play Console</strong> to submit your app.</li></ol><h3>Deployment on Google Play Story using Expo</h3><p>Before publishing, we need to generate a <strong>production-ready deployment build</strong>. Run the following command from your project directory:</p><pre>eas build -p android --profile production</pre><p>This will create a <strong>production build</strong> that can be uploaded to the <strong>Google Play Store</strong> or published on <strong>Expo</strong>. 🚀</p><p>Once the build is complete, we’ll move on to publishing it! 🎉</p><p>Lets follow these steps to deploy it.</p><h3>1. Initialize EAS in Your Project</h3><p>Navigate to your project folder:</p><pre>cd MyApp<br>eas init</pre><p>This will create an eas.json file where you can configure your builds.</p><h3>2. Configure Your eas.json File</h3><p>Edit the eas.json file in your project root to define a <strong>production build</strong> profile.</p><pre>{<br>  &quot;build&quot;: {<br>    &quot;production&quot;: {<br>      &quot;distribution&quot;: &quot;store&quot;,<br>      &quot;android&quot;: {<br>        &quot;buildType&quot;: &quot;app-bundle&quot;<br>      },<br>      &quot;ios&quot;: {<br>        &quot;simulator&quot;: false<br>      }<br>    }<br>  }<br>}</pre><ul><li>&quot;app-bundle&quot; → Required for Play Store submission.</li><li>&quot;store&quot; → Ensures the build is signed for distribution.</li></ul><h3>3. Set Up App Store &amp; Play Store Credentials</h3><h3>For Android</h3><p>Expo can manage credentials automatically. If you want to provide your own Keystore, run:</p><pre>eas credentials</pre><p>Or, let Expo generate one during the build.</p><h3>4. Build the Production Version</h3><p>Run the following command to start the build:</p><pre>eas build -p android --profile production</pre><ul><li>This will generate an <strong>Android App Bundle (AAB)</strong> file.</li><li>The build process runs on <strong>Expo servers</strong>, so <strong>wait for the completion link</strong>.</li></ul><h3>5. Download the Build</h3><p>Once the build is complete, Expo will give you a download link. Copy the URL and download the .aab file.</p><h3>6. Upload AAB to Google Play Store</h3><ol><li><strong>Go to Google Play Console</strong> (play.google.com/console)</li><li><strong>Create a New App</strong>:</li></ol><ul><li>Fill in app name, language, and other details.</li><li>Select “App” and choose your category.</li></ul><p><strong>3. Upload the AAB</strong>:</p><ul><li>Navigate to <strong>Production → Create a new release</strong>.</li><li>Upload the <strong>AAB file</strong> downloaded from Expo.</li></ul><p><strong>4. Complete the Store Listing</strong>:</p><ul><li>Add an app description, screenshots, and privacy policy.</li></ul><p><strong>5. Submit for Review</strong>:</p><ul><li>Click <strong>“Submit for Review”</strong> and wait for Google to approve your app.</li></ul><h3>7. Deploy Updates Using eas update</h3><p>Once your app is live, you can push updates without needing a new Play Store submission.</p><p>To update your production build:</p><pre>eas update --branch production</pre><ul><li>This pushes updates to all users without requiring a full build.</li><li><strong>Make sure you test thoroughly before updating production.</strong></li></ul><p>🎉 <strong>Done! Your Expo app is now live on Google Play Store!</strong></p><p>🎉 <strong>Congratulations!</strong> You have successfully set up, built, and launched your React Native app for real-time testing. Now, you can develop with confidence, knowing your changes reflect instantly on your device or emulator. 🚀 <strong>Happy coding!</strong> 😊</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9766b02eec2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Zero to 100: Achieve a Perfect SEO Score for Your Website]]></title>
            <link>https://medium.com/@sumitthrita.dev/from-zero-to-100-achieve-a-perfect-seo-score-for-your-website-a99609deef09?source=rss-d46e263d7c3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a99609deef09</guid>
            <category><![CDATA[seo-optimization]]></category>
            <category><![CDATA[seo-for-beginners]]></category>
            <category><![CDATA[improve-website-ranking]]></category>
            <category><![CDATA[google-seo]]></category>
            <category><![CDATA[best-seo-practices]]></category>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Wed, 26 Feb 2025 10:05:37 GMT</pubDate>
            <atom:updated>2025-02-28T17:14:23.599Z</atom:updated>
            <content:encoded><![CDATA[<p>Achieving a perfect 100% SEO score for your website may seem like an impossible task, but with the right strategies and optimizations, you can get there. This blog will walk you through the essential SEO techniques, best practices, and real-life examples to help you maximize your website’s ranking potential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*17MRfu8kAKQjINNX_vt1_A.jpeg" /><figcaption>Image by <a href="https://www.freepik.com/free-vector/seo-analysis-isometric-composition-with-web-optimization-symbols_7378453.htm#fromView=keyword&amp;page=1&amp;position=29&amp;uuid=1804d4e1-2ac4-4e22-8bd5-1b2fbffd6726&amp;query=Seo">Storyset</a> on Freepik</figcaption></figure><p>Before moving on anything, lets first install SEO Meta google chrome extension. It displays all meta data and main SEO information of your website for the best SEO. Pin it in your chrome extension bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iqr9Qm9V5-yk_L7IkfGJWQ.png" /><figcaption>SEO meta in 1 Click</figcaption></figure><p>Now lets check SEO for our project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k1xRPIa0e8ybyPQ0JxdgkQ.png" /><figcaption>SEO summary</figcaption></figure><p>Now we will check SEO percentage and performace for our website. Click on <strong>Analyze Page load.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFHnPXodT17PU2sNqS0AJA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vN_jdNI1TBKRFJhSOmBRrg.png" /></figure><p>As we can see there are so many things missing, but don’t worry as we are going to fix all the above errors. Just keep goin with this blog.</p><p>Lets discuss various type of methods to achieve 100% SEO score.</p><h3>1. Implement On-Page SEO Best Practices</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DF2slS4i0RHgBEkD2IjjWw.jpeg" /><figcaption>Image by <a href="https://www.freepik.com/free-vector/seo-marketing-concept-with-research-symbols-world-map-magnifier_3977401.htm#fromView=keyword&amp;page=1&amp;position=43&amp;uuid=1804d4e1-2ac4-4e22-8bd5-1b2fbffd6726&amp;query=Seo">Storyset</a> on Freepik</figcaption></figure><ol><li><strong>Use proper heading structures (H1, H2, H3, etc.). </strong>There should be exactly 1 <strong>H1 tag</strong>, atleast 1 <strong>H2 tag </strong>and others can be any of other heading tags.</li><li><strong>Include primary keywords in title tags and meta descriptions.</strong></li><li>If you’re working on React project then in your index.html file include following meta tags.</li><li>Add canonical link also in your index.html.</li></ol><blockquote>A <strong>canonical link</strong> (rel=&quot;canonical&quot;) is an HTML tag used to specify the <strong>preferred version of a webpage</strong>. It helps prevent <strong>duplicate content issues</strong> by telling search engines which URL to index when multiple URLs point to the same or similar content.</blockquote><blockquote>Why Use Canonical Links?</blockquote><blockquote>✅ <strong>Avoids Duplicate Content Issues</strong> — Ensures that search engines don’t penalize your site for duplicate pages.<br>✅ <strong>Improves SEO Ranking</strong> — Helps consolidate ranking signals for similar pages.<br>✅ <strong>Boosts Link Equity</strong> — Prevents dilution of backlinks across multiple URL versions.<br>✅ <strong>Optimizes Search Engine Crawling</strong> — Saves crawl budget by directing bots to the primary version of a page.</blockquote><blockquote>How Canonical Links Work</blockquote><blockquote>If you have multiple URLs that serve the same content, such as:</blockquote><blockquote><a href="https://example.com/page">https://example.com/page</a></blockquote><blockquote><a href="https://example.com/page?ref=123">https://example.com/page?ref=123</a></blockquote><blockquote><a href="https://example.com/page#section">https://example.com/page#section</a></blockquote><blockquote>You should add a canonical tag to the <strong>head section</strong> of your HTML:</blockquote><blockquote>&lt;link rel=&quot;canonical&quot; href=&quot;https://example.com/page&quot; /&gt;</blockquote><blockquote>This tells Google that https://example.com/page is the main version and should be indexed.</blockquote><p>5. Add <strong>robots.text</strong> file in your project.</p><blockquote>A <strong>robots.txt</strong> file is a simple text file placed in the root directory of your website that tells search engine bots <strong>which pages to crawl and which to ignore</strong>.</blockquote><blockquote>Why Use Robots.txt?</blockquote><blockquote>✅ <strong>Prevents Indexing of Sensitive Pages</strong> — You can block admin pages, login pages, and other non-public URLs.<br>✅ <strong>Optimizes Crawl Budget</strong> — Ensures search engines focus on important pages rather than wasting resources on unnecessary ones.<br>✅ <strong>Avoids Duplicate Content Issues</strong> — Prevents indexing of duplicate or low-value pages.</blockquote><blockquote>Example of a Robots.txt File</blockquote><blockquote>User-agent: *<br>Disallow: /admin/<br>Disallow: /login/<br>Disallow: /cart/<br>Allow: /<br>Sitemap: https://example.com/sitemap.xml</blockquote><blockquote><strong>Explanation:</strong></blockquote><blockquote>User-agent: * → Applies rules to all search engines.</blockquote><blockquote>Disallow: /admin/ → Prevents bots from crawling the /admin/ directory.</blockquote><blockquote>Allow: / → Allows everything else to be crawled.</blockquote><blockquote>Sitemap: https://example.com/sitemap.xml → Directs search engines to the sitemap.</blockquote><blockquote><strong>Where to Place robots.txt?</strong> Place it in the root directory of your site: <a href="https://example.com/robots.txt">https://example.com/robots.txt</a></blockquote><pre>&lt;meta<br>  name=&quot;description&quot;<br>  content=&quot;Any Description between 120-320 characters&quot;<br>/&gt;<br>&lt;meta name=&quot;keywords&quot; content=&quot;Best Developer portfolio, Sumit Full Stack Developr&quot; /&gt;<br>&lt;meta name=&quot;publisher&quot; content=&quot;Sumit Kumar&quot; /&gt;<br>&lt;meta name=&quot;robots&quot; content=&quot;index, follow&quot; /&gt;<br>&lt;meta name=&quot;author&quot; content=&quot;Sumit Kumar&quot; /&gt;<br>&lt;title&gt;Project Title&lt;/title&gt;<br>&lt;link rel=&quot;canonical&quot; href=&quot;https://wwww.yourUrl.com&quot; /&gt;</pre><p><strong>6. Ensure content readability</strong> by writing in short paragraphs and using bullet points in your project.</p><p><strong>7. Optimize for mobile</strong> with a responsive design.</p><h3>2. Improve Technical SEO</h3><ul><li><strong>Ensure an SEO-friendly URL structure</strong> (e.g., example.com/best-seo-practices instead of example.com/page?id=123).</li><li><strong>Fix broken links</strong> to prevent dead-end pages.</li><li><strong>Submit an XML sitemap</strong> to Google Search Console.</li><li><strong>Enable HTTPS</strong> for a secure connection.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*StDv5EEA6PkDprFM9c0-ig.jpeg" /><figcaption>Image by <a href="https://www.freepik.com/free-vector/hand-drawn-flat-design-ssl-illustration_21902027.htm#fromView=search&amp;page=1&amp;position=10&amp;uuid=00fe3223-ba5c-4d22-8ed9-8e429d4e0a34&amp;query=ssl">Storynet</a> on Freepik</figcaption></figure><h3>Sitemap.xml</h3><p>A <strong>sitemap.xml</strong> file is a crucial part of <strong>On site SEO</strong> that helps search engines like <strong>Google, Bing, and Yahoo</strong> efficiently crawl and index your website. If you are working with <strong>Next.js</strong> or <strong>React</strong>, understanding sitemaps can significantly improve your website’s ranking and visibility.</p><p>In this section, we will cover:</p><p>What a sitemap.xml file is</p><p>How search engines use it</p><p>How to create and implement a sitemap in <strong>Next.js</strong> and <strong>React</strong></p><p>A real-world example of a sitemap file</p><h3>a. What is a Sitemap.xml File?</h3><p>A <strong>sitemap.xml</strong> file is an XML document that contains a structured list of <strong>URLs on your website</strong>. It serves as a guide for search engine bots (like Googlebot) to discover about the urls (or pages) present in your website and index your pages efficiently.</p><h3>Why is a Sitemap Important?</h3><p>✅ <strong>Improves SEO</strong> — Ensures all important pages are indexed by search engines.<br>✅ <strong>Helps Google Discover New Pages</strong> — If your site has deep pages, a sitemap ensures they get crawled.<br>✅ <strong>Improves Crawl Efficiency</strong> — Search engines prioritize important pages.<br>✅ <strong>Essential for Large &amp; Dynamic Sites</strong> — If your website has a lot of pages or frequent updates, sitemaps help keep search engines updated.</p><h3>b. How Search Engines Use Sitemaps</h3><p>When you submit a sitemap.xml file to <strong>Google Search Console</strong>, Google uses it to:</p><ol><li><strong>Discover URLs</strong> — The sitemap tells Google which pages exist on your site.</li><li><strong>Check Last Modified Dates</strong> — Google sees when each page was last updated (&lt;lastmod&gt; tag).</li><li><strong>Prioritize Crawling</strong> — The priority tag helps Google determine which pages are most important.</li><li><strong>Decide Crawl Frequency</strong> — The changefreq tag suggests how often Google should check for updates.</li></ol><p>Once indexed, your pages start appearing in search results when users search for relevant keywords.</p><h3>c. Sitemap Example (Based on a Portfolio Website)</h3><p>Here’s a sample sitemap.xml for a portfolio website:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;urlset xmlns=&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;&gt;<br>  &lt;url&gt;<br>    &lt;loc&gt;https://yourUrl.com/&lt;/loc&gt;<br>    &lt;lastmod&gt;2025-02-26&lt;/lastmod&gt;<br>    &lt;changefreq&gt;weekly&lt;/changefreq&gt;<br>    &lt;priority&gt;1.0&lt;/priority&gt;<br>  &lt;/url&gt;<br>  &lt;url&gt;<br>    &lt;loc&gt;https://yourUrl.com/about&lt;/loc&gt;<br>    &lt;lastmod&gt;2025-02-26&lt;/lastmod&gt;<br>    &lt;changefreq&gt;yearly&lt;/changefreq&gt;<br>    &lt;priority&gt;0.6&lt;/priority&gt;<br>  &lt;/url&gt;<br>  &lt;url&gt;<br>    &lt;loc&gt;https://yourUrl.com/projects&lt;/loc&gt;<br>    &lt;lastmod&gt;2025-02-26&lt;/lastmod&gt;<br>    &lt;changefreq&gt;monthly&lt;/changefreq&gt;<br>    &lt;priority&gt;0.8&lt;/priority&gt;<br>  &lt;/url&gt;<br>  &lt;url&gt;<br>    &lt;loc&gt;https://yourUrl.com/resume&lt;/loc&gt;<br>    &lt;lastmod&gt;2025-02-26&lt;/lastmod&gt;<br>    &lt;changefreq&gt;yearly&lt;/changefreq&gt;<br>    &lt;priority&gt;0.5&lt;/priority&gt;<br>  &lt;/url&gt;<br>  &lt;url&gt;<br>    &lt;loc&gt;https://yourUrl.com/contact&lt;/loc&gt;<br>    &lt;lastmod&gt;2025-02-26&lt;/lastmod&gt;<br>    &lt;changefreq&gt;monthly&lt;/changefreq&gt;<br>    &lt;priority&gt;0.7&lt;/priority&gt;<br>  &lt;/url&gt;<br>&lt;/urlset&gt;</pre><h3>Explanation of Tags:</h3><ul><li><strong>&lt;loc&gt;</strong>: The URL of the page.</li><li><strong>&lt;lastmod&gt;</strong>: The last modified date, which helps search engines determine updates.</li><li><strong>&lt;changefreq&gt;</strong>: Suggests how often content changes (weekly, monthly, yearly, etc.).</li><li><strong>&lt;priority&gt;</strong>: Indicates page importance on a scale from 0.1 (low) to 1.0 (high).</li></ul><h3>d. How to Create a Sitemap in Next.js</h3><p>If you’re using <strong>Next.js</strong>, you can dynamically generate a sitemap using next-sitemap.</p><h3>Step 1: Install next-sitemap</h3><pre>npm install next-sitemap</pre><h3>Step 2: Create a Config File</h3><p>In your project root, create a next-sitemap.config.js file:</p><pre>module.exports = {<br>  siteUrl: &#39;https://nleinas.com&#39;,<br>  generateRobotsTxt: true, // Generates a robots.txt file<br>};</pre><h3>Step 3: Generate the Sitemap</h3><p>Run the following command:</p><pre>npx next-sitemap</pre><p>This will create a sitemap.xml file inside the public/ directory.</p><h3>Step 4: Submit to Google</h3><p>Uploading a <strong>sitemap.xml</strong> file to <strong>Google Search Console</strong> helps search engines discover and index your website faster. Follow these steps to submit your sitemap:</p><blockquote>A: Ensure Your Sitemap is Accessible</blockquote><blockquote>Before submitting your sitemap, confirm that it is correctly generated and accessible.</blockquote><blockquote>✅ Open a browser and visit:</blockquote><blockquote>https://yourwebsite.com/sitemap.xml</blockquote><blockquote>🔹 If the XML file loads correctly and displays your URLs, your sitemap is ready to be submitted.</blockquote><blockquote>B: Log in to Google Search Console</blockquote><blockquote><strong>Go to</strong> Google Search Console.</blockquote><blockquote><strong>Sign in</strong> with your Google account.</blockquote><blockquote><strong>Select Your Website</strong> (Property) from the Search Console dashboard.</blockquote><blockquote>If you haven’t added your website yet, click <strong>“Add Property”</strong> and verify your domain.</blockquote><blockquote>Complete your verification by <strong>Domain Name Provider</strong> option.</blockquote><blockquote>C: Navigate to the Sitemap Section</blockquote><blockquote>In the left-side menu, click on <strong>“Sitemaps”</strong> under the <strong>Indexing</strong> section.</blockquote><blockquote>You will see an option <strong>“Add a new sitemap”</strong>.</blockquote><blockquote>D: Submit Your Sitemap</blockquote><blockquote>In the “Add a new sitemap” field, enter your sitemap URL (only the last part): sitemap.xml</blockquote><blockquote>Example: If your sitemap is at https://yourwebsite.com/sitemap.xml, just enter: sitemap.xml</blockquote><blockquote>Click <strong>“Submit”</strong>.</blockquote><blockquote>E: Check Sitemap Status</blockquote><blockquote>After submitting, Google will process your sitemap.</blockquote><blockquote>Refresh the page after a few minutes and check the <strong>status</strong>:</blockquote><blockquote>✅ <strong>Success</strong> → Your sitemap has been submitted successfully.</blockquote><blockquote>⚠️ <strong>Errors</strong> → If you see an error, fix any issues mentioned and resubmit the sitemap.</blockquote><blockquote>F: Monitor Sitemap Performance</blockquote><blockquote>In Google Search Console, go to <strong>“Coverage”</strong> under the <strong>Indexing</strong> section.</blockquote><blockquote>This will show how many pages from your sitemap are indexed.</blockquote><blockquote>Keep checking periodically to ensure Google is indexing your latest content.</blockquote><blockquote>Bonus: Resubmit Sitemap When You Update It</blockquote><blockquote>If you update your website frequently (new pages, blog posts, etc.), <strong>resubmit your sitemap</strong> so Google indexes new pages faster.</blockquote><blockquote>You can do this by deleting the existing sitemap and adding it again or clicking the <strong>“Resubmit”</strong> button in Search Console.</blockquote><h3>e. How to Create a Sitemap in a React (Vite/CRA) Project</h3><p>For a <strong>React (Vite or Create React App)</strong> project, since it’s client-side only, you must <strong>manually create a static sitemap</strong>.</p><h3>Step 1: Create a sitemap.xml File</h3><p>Inside the public/ folder, create sitemap.xml and paste the sitemap content.</p><h3>Step 2: Make Sure It’s Accessible</h3><p>Your sitemap should be available at:</p><pre>https://yourwebsite.com/sitemap.xml</pre><p>If you’re using <strong>React Router</strong>, ensure search engines can reach static files in public/.</p><h3>Step 3: Submit to Google</h3><p>Just like in Next.js, go to <strong>Google Search Console</strong> and submit the sitemap URL.</p><h3>f. Best Practices for Sitemaps</h3><ul><li><strong>Always keep your sitemap updated</strong> when adding or removing pages.</li><li><strong>Avoid including unnecessary URLs</strong> (e.g., internal search results, admin pages).</li><li><strong>Use absolute URLs</strong> (e.g., <a href="https://example.com/about,">https://example.com/about,</a> not /about).</li><li><strong>Ensure all pages in the sitemap return a </strong>200<strong> status code</strong> (no 404 or 301).</li><li><strong>Submit the sitemap to Google Search Console and Bing Webmaster Tools</strong>.</li></ul><h3>3. Optimize Your Website for Speed</h3><p>Google prioritizes fast-loading websites. Here’s what you need to do:</p><ul><li><strong>Use a CDN (Content Delivery Network)</strong> to serve content faster.</li><li><strong>Optimize images</strong> using WebP format and compression tools like TinyPNG.</li><li><strong>Minimize CSS and JavaScript files</strong> by using minification techniques.</li><li><strong>Leverage browser caching</strong> to reduce repeated load times.</li><li>Use <strong>lazy loading</strong> for images.</li></ul><h3>4. Master Content Optimization</h3><p>Content is king! Follow these principles:</p><ul><li><strong>Create high-quality, original content</strong> that provides value to users.</li><li><strong>Use LSI (Latent Semantic Indexing) keywords</strong> to support the main keyword.</li><li><strong>Add multimedia elements</strong> like images, infographics, and videos to increase engagement.</li><li><strong>Encourage longer time on page</strong> by structuring content with engaging subheadings and internal links.</li></ul><h3>5. Build High-Quality Backlinks</h3><ul><li><strong>Guest post on relevant high-authority websites.</strong></li><li><strong>Use internal linking</strong> to distribute authority across your site.</li><li><strong>Engage in broken link building</strong> by reaching out to site owners with replacement content.</li></ul><h3>6. Optimize for Core Web Vitals</h3><p>Google’s Core Web Vitals are crucial for ranking:</p><ul><li><strong>Largest Contentful Paint (LCP)</strong> — Ensure main content loads within 2.5 seconds.</li><li><strong>First Input Delay (FID)</strong> — Optimize JavaScript to ensure fast interactions.</li><li><strong>Cumulative Layout Shift (CLS)</strong> — Prevent page elements from shifting unexpectedly.</li></ul><h3>7. Leverage Local SEO (If Applicable)</h3><ul><li><strong>Claim and optimize your Google My Business (GMB) listing.</strong></li><li><strong>Get customer reviews</strong> on Google and other review sites.</li><li><strong>Optimize for local keywords</strong> (e.g., “best coffee shop in Bengaluru”).</li></ul><h3>8. Monitor and Improve SEO Regularly</h3><ul><li><strong>Use Google Analytics and Search Console</strong> to track traffic and keyword performance.</li><li><strong>Perform regular SEO audits</strong> using tools like Ahrefs or SEMrush.</li><li><strong>Update old content</strong> with fresh information and new keywords.</li></ul><h3>Final Thoughts</h3><p>Reaching a 100% SEO score requires ongoing effort, but by implementing these strategies, your website can climb the search rankings and gain more organic traffic. Focus on speed, content quality, technical optimizations, and continuous improvements to achieve lasting success.</p><p>Hurray! see finally we have achieved 100% SEO for our project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9wGJ34IPqbFDONxSf-Fuew.png" /><figcaption>Lighthouse analysis</figcaption></figure><p>Start optimizing today and watch your website soar to SEO perfection! 🚀</p><p>You can visit the project i have achieved 100% SEO for. <a href="https://nleinas.com/">Leina Designer Portfolio</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a99609deef09" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JSON]]></title>
            <link>https://medium.com/@sumitthrita.dev/json-5f5c441cba1f?source=rss-d46e263d7c3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f5c441cba1f</guid>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Fri, 21 Feb 2025 10:03:51 GMT</pubDate>
            <atom:updated>2025-02-21T10:03:51.103Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a4uOhEBnA6T4vEhKJxSGpg.png" /></figure><h3>What is JSON?</h3><p><strong>JSON</strong> stands for <strong>JavaScript Object Notation</strong>, and it is a lightweight, text-based format used for storing and exchanging data between a server and a client, or between applications. It is easy for humans to read and write, and easy for machines to parse and generate, which makes it ideal for data interchange in web development.</p><p>JSON was derived from JavaScript, but it is language-independent, meaning it can be used with most modern programming languages, including Python, Ruby, Java, and PHP.</p><h3>Key Features of JSON:</h3><ol><li><strong>Human-readable</strong>: JSON is simple to understand and write. Its syntax is minimal and structured in a way that makes it easy to grasp, even for beginners.</li><li><strong>Lightweight</strong>: The format is very concise, making it an efficient option for transmitting data over the internet.</li><li><strong>Text-based</strong>: Since JSON is a text format, it is easily transmitted over network protocols like HTTP and can be stored in text files.</li><li><strong>Language-independent</strong>: Although JSON has roots in JavaScript, it is not tied to any one programming language. Most languages have built-in support for parsing and generating JSON.</li></ol><h3>Structure of JSON:</h3><p>JSON is built on two main structures:</p><ol><li><strong>Objects</strong>: These are collections of key-value pairs enclosed in curly braces {}. Each key is a string, and the value can be a string, number, boolean, array, another object, or null.</li></ol><p>Example:</p><pre>{<br>  &quot;name&quot;: &quot;John&quot;,<br>  &quot;age&quot;: 30,<br>  &quot;isStudent&quot;: false<br>}</pre><p><strong>2. Arrays</strong>: Arrays are ordered lists of values, which are enclosed in square brackets []. The values inside an array can be any valid JSON data type (strings, numbers, objects, etc.).</p><ul><li>Example:</li></ul><pre>{<br>  &quot;students&quot;: [&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;]<br>}</pre><h3>JSON Syntax Rules:</h3><ul><li><strong>Strings</strong> must be enclosed in double quotes &quot;.</li><li><strong>Numbers</strong> can be integers or floating-point values (no quotes).</li><li><strong>Boolean</strong> values can be true or false (without quotes).</li><li><strong>Null</strong> is represented as null (without quotes).</li><li><strong>Key-value pairs</strong> are separated by a colon :.</li><li><strong>Items</strong> in an object or array are separated by commas ,.</li></ul><h3>Example JSON Data:</h3><p>Here’s a more detailed example of a JSON structure:</p><pre>{<br>  &quot;person&quot;: {<br>    &quot;firstName&quot;: &quot;Jane&quot;,<br>    &quot;lastName&quot;: &quot;Doe&quot;,<br>    &quot;age&quot;: 25,<br>    &quot;isMarried&quot;: false,<br>    &quot;children&quot;: [<br>      {<br>        &quot;name&quot;: &quot;Alice&quot;,<br>        &quot;age&quot;: 5<br>      },<br>      {<br>        &quot;name&quot;: &quot;Bob&quot;,<br>        &quot;age&quot;: 3<br>      }<br>    ],<br>    &quot;address&quot;: {<br>      &quot;street&quot;: &quot;123 Main St&quot;,<br>      &quot;city&quot;: &quot;Sample City&quot;,<br>      &quot;zip&quot;: &quot;12345&quot;<br>    }<br>  }<br>}</pre><p>In this example:</p><ul><li>The top-level object has a key person, which holds another object with several key-value pairs.</li><li>The children key contains an array of objects, each representing a child with a name and age.</li><li>The address key holds another nested object with information about the person&#39;s address.</li></ul><h3>How JSON is Used:</h3><ol><li><strong>Data Exchange in Web Applications</strong>: JSON is commonly used to transmit data between a web server and a web application. For example, a web app might send a GET request to a server, and the server responds with data in JSON format, which is then rendered on the frontend.</li></ol><ul><li><strong>Example use case</strong>: When you log in to a website, the server might send your user information (such as name, email, and preferences) in JSON format.</li></ul><p><strong>2. APIs</strong>: JSON is a common data format for web APIs. When you interact with APIs (for instance, a weather service or social media API), the server often sends responses in JSON format, which you can easily parse and use in your application.</p><p><strong>3. Configuration Files</strong>: JSON is used for configuration files, where settings for software applications are stored in a simple key-value format.</p><p><strong>4. Storage</strong>: Many NoSQL databases, such as MongoDB, store data in a JSON-like format (often referred to as BSON — Binary JSON).</p><h3>Advantages of JSON:</h3><ul><li><strong>Lightweight and Fast</strong>: Due to its simplicity, JSON is faster to transmit and parse compared to other formats like XML.</li><li><strong>Ease of Use</strong>: JSON is supported by almost all programming languages, and it integrates easily with JavaScript.</li><li><strong>Structured Data</strong>: It provides a clean and consistent way to represent complex data structures like objects and arrays.</li></ul><h3>JSON vs. XML:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qsaV8SAnbtpBI42HN2DEwQ.png" /></figure><p>While <strong>XML</strong> was once the standard for data exchange, JSON has gained widespread popularity for a number of reasons:</p><ul><li><strong>Less Verbose</strong>: JSON is less cluttered and more compact than XML, reducing bandwidth and making it easier to read.</li><li><strong>Ease of Parsing</strong>: JSON is easier to parse, especially in JavaScript, as it is natively supported by the language. XML requires a more complex parser.</li><li><strong>No Need for Closing Tags</strong>: Unlike XML, which requires both opening and closing tags for elements, JSON uses key-value pairs, which is more straightforward.</li></ul><h3>Conclusion:</h3><p>JSON is a powerful and flexible format for exchanging data in modern web and mobile applications. Its simplicity, speed, and wide support across programming languages make it the go-to choice for data serialization. Whether you’re working with APIs, storing configurations, or sending data between client and server, JSON makes it easier to handle and manipulate data efficiently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f5c441cba1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Complete Guide for Backend Driven Frontend]]></title>
            <link>https://medium.com/@sumitthrita.dev/complete-guide-for-backend-driven-frontend-fcbb3f003fdb?source=rss-d46e263d7c3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcbb3f003fdb</guid>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Fri, 21 Feb 2025 09:54:40 GMT</pubDate>
            <atom:updated>2025-02-21T09:54:40.686Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uLuIN5Vz-wM_Q4DhB-6MAQ.png" /><figcaption>BE Driven Frontend</figcaption></figure><p>A <strong>backend-driven frontend</strong> is an architectural approach in web development where much of the logic, content, and behavior of the user interface (UI) are controlled by the <strong>backend server</strong> rather than by the frontend (client-side) application. In this setup, the backend dynamically sends data or configurations to the frontend, which then renders and presents the content accordingly.</p><h3><strong>Key Concepts</strong></h3><ul><li><strong>Dynamic Rendering</strong>: The frontend doesn’t have the full static or predefined structure. Instead, it renders content based on the data or instructions provided by the backend. The backend might decide what content, structure, or UI elements are shown depending on user roles, preferences, or other factors.</li><li><strong>Less Client-Side Logic</strong>: Instead of building complex front-end logic with JavaScript or frameworks like React, Vue, or Angular, the backend handles much of the application logic and decides what data to send to the client for display.</li><li><strong>API-Driven UI</strong>: The backend typically exposes APIs (like REST or GraphQL) that the frontend consumes. These APIs may not just provide data but also configuration or templates that the frontend uses to render the UI.</li><li><strong>Decoupling of UI and Backend</strong>: The frontend can remain relatively lightweight, with minimal business logic and rendering instructions being handled on the server. This is particularly useful when the same backend serves multiple platforms (like web, mobile apps, etc.), and the frontend is simply responsible for presenting the data and UI.</li></ul><h3>Advantages</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aprmgwUmRIo5TiBJ5weOOg.png" /><figcaption>BE Driven Frontend Advantages</figcaption></figure><ul><li><strong>Centralized Control</strong>: The backend can control the UI’s layout, content, and structure, making it easier to enforce consistency across different platforms (e.g., mobile, web).</li><li><strong>Simpler Frontend</strong>: The frontend code may be simpler and more focused on displaying data rather than managing the logic and content structure.</li><li><strong>Faster Development</strong>: Since the backend handles much of the logic, frontend developers might focus more on integrating and displaying the data without having to worry about business rules.</li></ul><h3>Contrast with Frontend-Driven:</h3><p>In a <strong>frontend-driven</strong> approach, the frontend handles most of the logic and rendering, typically fetching data from APIs and making decisions on what to display based on the user’s interactions. It involves more client-side technologies like JavaScript frameworks (React, Angular, etc.) to manage the UI and state.</p><p>In summary, a backend-driven frontend relies more on the server for the UI layout, content, and behavior, with the frontend acting primarily as a display layer, whereas in a frontend-driven architecture, the client has more control over the UI logic and rendering.</p><h3>Our Approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZrFMVE3vdv_uDbPjYwrdHA.png" /></figure><p>We won’t get complete HTML from backend. We will be getting a JSON for the UI and frontend will render this json. This json will have all information for UI, color, fonts etc.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcbb3f003fdb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to write Test Cases in React/Next projects.]]></title>
            <link>https://medium.com/@sumitthrita.dev/how-to-write-test-cases-in-react-next-projects-432c1f9a33ba?source=rss-d46e263d7c3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/432c1f9a33ba</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[test-case]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[react-test]]></category>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Wed, 13 Mar 2024 20:01:01 GMT</pubDate>
            <atom:updated>2024-03-13T20:01:01.414Z</atom:updated>
            <content:encoded><![CDATA[<h3>For functions which are defined outside the component and used in current component. Mock them</h3><pre>jest.mock(&quot;../../../../services/leadService&quot;, () =&gt; ({   <br>  ...jest.requireActual(&quot;../../../../services/leadService&quot;),   <br>  updateCCOSLeadData: jest.fn((payload: any) =&gt; {     <br>    if (payload === &quot;Flexi 12&quot;)       <br>      return { status: &quot;SUCCESS&quot;, };     <br>    else       <br>      return { status: &quot;FAILURE&quot;, };   <br>  }), <br>}));</pre><h3>For state and dispatch of context</h3><pre>test(&quot;renders data&quot;, () =&gt; {<br>    render(<br>      &lt;Context.Provider<br>        value={{<br>          isAuthenticated: true,<br>          dispatch: () =&gt; null,<br>          state: {<br>            ...initialState,<br>            lead: {<br>              ...initialState.lead,<br>              leadId: &quot;SCUBL00001BC&quot;,<br>              activeEndPoint: &quot;/api/ccs/v1/web/cases/pages/SCUBL00001BC?pageId=creditAppraisalMemo&quot;,<br>            },<br>          },<br>        }}<br>      &gt;<br>        &lt;SelectOnView data={dataToPass} className=&#39;mt-2&#39; disableActions={false} /&gt;<br>      &lt;/Context.Provider&gt;<br>    );<br><br>    // Ensure form elements are present<br>    expect(screen.getByText(&quot;Product Variant&quot;)).toBeInTheDocument();<br>    expect(screen.getByText(&quot;Normal&quot;)).toBeInTheDocument();<br>  });</pre><h3>For input change</h3><pre>const inputElement = document.querySelector(&#39;input[id=&quot;recommendedFOIR&quot;]&#39;);<br>inputElement &amp;&amp; fireEvent.change(inputElement, { target: { value: &quot;12&quot; } });</pre><h3>For select change</h3><pre>// Just make sure that this Select should be at before all other Selects in dom.<br>// If options for Select are coming from  <br>const selectIcon = document.querySelector(&#39;input[value=&quot;BANKING&quot;]&#39;);<br>selectIcon &amp;&amp; fireEvent.change(selectIcon, { target: { value: &quot;CASH_PROFIT&quot; } });<br><br>OR <br><br>PASS data-testid to select<br><br>const borrowerNameSelect = screen.getByTestId(&quot;borrowerName_3_3&quot;);<br>if (borrowerNameSelect) {<br>  const selectInput = borrowerNameSelect.childNodes[1];<br>  fireEvent.change(selectInput, { target: { value: &quot;MATULIYA GUPTA&quot; } });<br>}<br>// for checking if it has changed<br>const borrowerFinal = document.querySelector(&#39;input[value=&quot;MATULIYA GUPTA&quot;]&#39;);<br>expect(borrowerFinal).toHaveValue(&quot;MATULIYA GUPTA&quot;);</pre><h3>For SearchSelect change</h3><pre>// for searchSelect of bank name<br>    const searchSelectButton = document.querySelector(&#39;button[title=&quot;Open&quot;]&#39;);<br>// you can get it by classname or any other way<br>    if (searchSelectButton) {<br>      fireEvent.click(searchSelectButton);<br>      expect(screen.getByText(&quot;ANZ Bank&quot;)).toBeInTheDocument(); // options text<br>      const bankOption = document.getElementById(&quot;bankName-option-0&quot;); // get any option<br>      bankOption &amp;&amp; fireEvent.click(bankOption);<br>      expect(screen.getByText(&quot;ADCB&quot;)).toBeInTheDocument(); // check if that option is in text field now.<br>    }</pre><h3>For Radio Button Change</h3><pre>const radioInput = document.querySelector(&#39;input[value=&quot;APPROVE&quot;]&#39;);<br>expect(radioInput).not.toBeChecked();<br>radioInput &amp;&amp; fireEvent.click(radioInput);<br>expect(radioInput).toBeChecked();<br><br>//another method<br><br>const radioInput = document.querySelector(&#39;input[value=&quot;APPROVE&quot;]&#39;);<br>radioInput &amp;&amp; fireEvent.click(radioInput);<br>const checkedSpan = document.getElementsByClassName(&quot;Mui-checked&quot;);<br>if (checkedSpan &amp;&amp; checkedSpan[0]) {<br>  const checkedInput = checkedSpan[0].childNodes[0];<br>  expect(checkedInput).toBeChecked();<br>}</pre><h3>For Button Click</h3><pre>const saveDetails = screen.getByText(&quot;Save Details&quot;);<br>expect(saveDetails).not.toBeDisabled();<br>fireEvent.click(saveDetails);</pre><h3>If some event has state change then use async and await waitFor</h3><pre>test(&quot;renders onChange for failure&quot;, async () =&gt; {<br>    render(<br>      &lt;Context.Provider<br>        value={{<br>          isAuthenticated: true,<br>          dispatch: () =&gt; null,<br>          state: {<br>            ...initialState,<br>            lead: {<br>              ...initialState.lead,<br>              leadId: &quot;SCUBL00001BC&quot;,<br>              activeEndPoint: &quot;/api/ccs/v1/web/cases/pages/SCUBL00001BC?pageId=creditAppraisalMemo&quot;,<br>            },<br>          },<br>        }}<br>      &gt;<br>        &lt;SelectOnView data={data} className=&#39;mt-2&#39; disableActions={false} /&gt;<br>      &lt;/Context.Provider&gt;<br>    );<br><br>    const selectIcon = document.querySelector(&#39;input[value=&quot;Normal&quot;]&#39;);<br>    await waitFor(() =&gt; {<br>      selectIcon &amp;&amp; fireEvent.change(selectIcon, { target: { value: &quot;Flexi 24&quot; } });<br>    });<br>  });</pre><h3>useEffect</h3><pre>import { renderHook } from &quot;@testing-library/react-hooks&quot;;<br>import axios from &quot;axios&quot;;<br>import MockAdapter from &quot;axios-mock-adapter&quot;;<br>// import custom hook - in this example extracted to a separate file<br>import useFetch from &quot;./useFetch&quot;;<br>test(&quot;useFetch performs multiple GET requests for different URLs&quot;, async () =&gt; {<br>  // fetch 1<br>  const initialValue = &quot;initial value&quot;;<br>  const mock = new MockAdapter(axios);<br>  const mockData = 1;<br>  const url = &quot;&lt;http://mock&gt;&quot;;<br>  mock.onGet(url).reply(200, mockData);<br>  const { result, waitForNextUpdate } = renderHook(() =&gt;<br>    useFetch(url, initialValue)<br>  );<br>  expect(result.current.data).toEqual(&quot;initial value&quot;);<br>  expect(result.current.loading).toBeTruthy();<br>  await waitForNextUpdate();<br>  expect(result.current.data).toEqual(1);<br>  expect(result.current.loading).toBeFalsy();<br>  // fetch 2<br>  const url2 = &quot;&lt;http://mock2&gt;&quot;;<br>  const mockData2 = 2;<br>  mock.onGet(url2).reply(200, mockData2);<br>  const initialValue2 = &quot;initial value 2&quot;;<br>  const { result: result2, waitForNextUpdate: waitForNextUpdate2 } = renderHook(<br>    () =&gt; useFetch(url2, initialValue2)<br>  );<br>  expect(result2.current.data).toEqual(&quot;initial value 2&quot;);<br>  expect(result2.current.loading).toBeTruthy();<br>  await waitForNextUpdate2();<br>  expect(result2.current.data).toEqual(2);<br>  expect(result2.current.loading).toBeFalsy();<br>});</pre><h3>For axios mocking</h3><pre>jest.mock(&quot;axios&quot;, () =&gt; {<br>  return {<br>    create: jest.fn(() =&gt; axios),<br>    post: jest.fn(() =&gt; Promise.resolve()),<br>    get: jest.fn(() =&gt; Promise.resolve(data)),<br>  };<br>});</pre><h3>For mocking constant value</h3><pre>jest.mock(&quot;../../../../util/featureFlags&quot;, () =&gt; ({<br>  get ADD_BANK_BY_PERFIOS() {<br>    return true;<br>  },<br>}));</pre><h3>For scroll</h3><pre>const element = document.querySelector(&#39;input[id=&quot;eleId&quot;]&#39;);<br>element &amp;&amp; fireEvent.scroll(element);</pre><h3>For hover</h3><pre>import userEvent from &#39;@testing-library/user-event&#39;;<br><br>describe(&quot;testCaseForHover&quot;, () =&gt; {<br>  test(&quot;renders data&quot;, async () =&gt; {<br>    render(<br>        &lt;Component /&gt;<br>    );<br><br>    //for element hover<br>    const element = document.querySelector(&#39;input[id=&quot;eleId&quot;]&#39;);<br>    <br>    element &amp;&amp; userEvent.hover(element);<br>  });<br>});</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=432c1f9a33ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Next or React Project Migration from NPM to yarn]]></title>
            <link>https://medium.com/@sumitthrita.dev/next-or-react-project-migration-from-npm-to-yarn-34965304dc04?source=rss-d46e263d7c3c------2</link>
            <guid isPermaLink="false">https://medium.com/p/34965304dc04</guid>
            <category><![CDATA[yarn-package-manager]]></category>
            <category><![CDATA[yarn-migration]]></category>
            <category><![CDATA[npm-package]]></category>
            <category><![CDATA[npm-to-yarn]]></category>
            <category><![CDATA[npm]]></category>
            <dc:creator><![CDATA[Sumit Kumar]]></dc:creator>
            <pubDate>Mon, 07 Aug 2023 11:34:12 GMT</pubDate>
            <atom:updated>2023-08-07T18:51:59.505Z</atom:updated>
            <content:encoded><![CDATA[<p>We are going to learn about package manager, NPM and yarn, their comparison and how to shift from NPM to yarn or yarn to NPM.</p><p>First of all lets know about “Package Manager”…</p><p>What is “Package Manager”?</p><p><strong>“Package Manager”</strong> is a collection of software tools that helps us to handle installation, updation and deletion of dependencies and configure projects related settings automatically. It helps us to focus on developing instead of the above mentioned things and makes installation process easy.</p><p>We have two most popular package manager i.e “<strong>NPM”</strong> and “<strong>yarn”</strong>. We shall discuss about it and compare as well.</p><p>Firstly,<strong> NPM</strong> (<strong>Node Package Manager</strong>) is the most used software registry. Many developers around the globe use <strong>NPM</strong> to share and borrow packages for their projects.</p><p>It has three main components:</p><ol><li><strong>Website</strong> :: use it to discover packages and manage your npm experience.</li><li><strong>CLI</strong> <strong>(Command Line Interface)</strong> :: developer can use terminal to interact with <strong>NPM</strong> (we can install, update &amp; delete dependencies using CLI).</li><li><strong>Registry </strong>:: Its a large public collection of Javascript software.</li></ol><p>Most of the developers use only <strong>CLI</strong> part to install dependencies in their projects using terminal.</p><p>Secondly,<strong> Yarn</strong> (<strong>Yet Another Resource Negotiator</strong>) was released by facebook in Oct, 2016. It was basically created to deal with drawbacks of <strong>NPM</strong>, such as perfomance and security issues. Yarn got famous soon for its safe, fast and reliable performance.</p><p><strong>NPM v/s Yarn</strong></p><ol><li><strong><em>Speed</em></strong></li></ol><p><strong><em>Yarn</em> ::</strong> Parallel installation of dependencies leads to faster installation, especially for larger projects.</p><p><strong><em>NPM</em> ::</strong> Installs dependencies sequentially, resulting in potentially longer installation times.</p><p>2.<strong> <em>Security</em></strong></p><p><strong><em>Yarn</em> :: </strong>Performs security checks during package download to avoid downloading dangerous scripts or incompatible dependencies.</p><p><strong><em>NPM</em> ::</strong> Provides security assessments with version 6 and offers the npm audit command to identify and fix vulnerabilities.</p><p>3. <strong><em>Cache</em></strong></p><p><strong><em>Yarn</em> ::</strong> Utilises a global cache to store dependencies, reducing duplication and improving overall performance.</p><p><strong><em>NPM</em> ::</strong> Relies on a local cache, which can result in duplication of dependencies across projects.</p><p>4. <strong><em>Storage</em></strong></p><p><strong><em>Yarn</em> ::</strong> With yarn version 2, dependencies are stored globally, reducing duplication and saving storage space.</p><p><strong><em>NPM</em> ::</strong> Dependencies are stored individually within each project, potentially leading to duplication and increased disk space usage.</p><p>5. <strong><em>Lock File</em></strong></p><p><strong><em>Yarn</em> ::</strong> Generates a <strong>yarn.lock</strong> file to ensure consistent and reproducible builds by locking dependency versions.</p><p><strong><em>NPM</em> ::</strong> Generates a <strong>package-lock.json</strong> file for the same purpose, allowing for consistent builds and resolving dependency versions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yFvhKgacjfTjlnvdtckkiA.png" /></figure><p><strong>Project Migration from NPM to yarn</strong></p><p>Yarn can use same <strong>package.json</strong> file as <strong>NPM</strong> to install packages from the <strong>NPM</strong> registry. So there won’t be any changes in <strong>package.json</strong> file.</p><p><strong><em>Step 1</em></strong> :: We will have to delete <strong>node_modules</strong> from root of our project which has all modules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*37SjRmOQ30visMT55U7wwQ.png" /></figure><p><strong><em>Step 2</em></strong> :: We will have to delete <strong>package-lock.json</strong> file also. It has all the information about the packages and dependencies like their version.</p><p><strong><em>Step 3</em></strong> :: Open <strong>terminal</strong> and go to your project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gPnCJal8i6nrn0Zt5HaAxw.png" /></figure><p><strong><em>Step 4</em></strong>:: We will install <strong>yarn</strong> globally using <strong>NPM</strong>. You can check if you have <strong>yarn</strong> in your system by running <strong><em>yarn —version</em></strong> in terminal.</p><pre>npm i -g yarn</pre><p>If getting permission error then you can run</p><pre>sudo npm i -g yarn</pre><p>Then provide your password and it will install yarn globally in your system.</p><p>Now you can check if it is installed successfully by running</p><pre>yarn --version</pre><p><strong><em>Step 5</em></strong>:: Now we will install all the dependencies mentioned in <strong>package.json</strong> file in our project. After this we will have <strong>node_modules</strong> and <strong>yarn.lock</strong> file in root of our project.</p><p><strong>yarn.lock</strong> file is equivalent to <strong>package-lock.json</strong>. It has all information about all the dependencies mentioned in <strong>package.json</strong> file.</p><p>To install run</p><pre>yarn</pre><p>It is equivalent to <strong>npm install</strong> command.</p><p>If yarn successfully installed all the dependencies then you will see <strong>node_modules </strong>and<strong> yarn.lock</strong> file.</p><p>Some people may face few errors while installing dependencies such as:</p><p><strong><em>Error1 </em></strong>:: error An unexpected error occurred: &quot;https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.6.tgz: unable to get local issuer certificate&quot;</p><p>To solve this error we have two ways.</p><ol><li>We can set registry in yarn config as <a href="https://registry.npm.js.org/">https://registry.npmjs.org</a>. To set run</li></ol><pre>yarn config set registry https://registry.npmjs.org</pre><p>2. We can turn off strict-ssl on yarn config. To turn off run</p><pre>yarn config set &quot;strict-ssl&quot; false -g</pre><p>But disabling strict-ssl won’t be advised and is not a good practice, so i will suggest you guys to follow the former to resolve this error.</p><p><strong><em>Error2</em></strong> :: <strong>Node version isn’t compatible try using version 17.0.0 or newer</strong></p><p>To solve this we can upgrade node version or install new recommended version of node.</p><p>Go to <a href="https://nodejs.org/en/download">https://nodejs.org/en/download</a> and download recommended version for your OS and install.</p><p>After installing you can check new version of node by running</p><pre>node --version</pre><p>Congrats!! We have successfully migrated our npm project to yarn.</p><p>Now we can install new dependency from npm using yarn using the below command.</p><pre>yarn add &lt;dependencyName&gt;</pre><p>It is equivalent to <strong>npm install &lt;dependencyName&gt;</strong>.</p><p>Now you can start your project by running <strong><em>yarn start</em></strong> or <strong><em>yarn run dev</em></strong> as it is mentioned in your <strong>package.json</strong> <em>scripts</em>.</p><p>Now for migrating it back to npm, we just need to delete <strong>node_modules</strong> and <strong>yarn.lock</strong> file. Keep <strong>package.json</strong> file as it is.</p><p>Now run</p><pre>npm install</pre><p>It will install all the dependencies mentioned in <strong>package.json</strong> file and create <strong>node_modules</strong> and <strong>package-lock.json</strong> file also.</p><p>Now you can start working on your project again.</p><p><strong>References</strong></p><ol><li>Wikipedia :: <a href="https://en.wikipedia.org/wiki/Package_manager#:~:text=A%20package%20manager%20or%20package,example%20of%20a%20package%20manager">https://en.wikipedia.org/wiki/Package_manager#:~:text=A%20package%20manager%20or%20package,example%20of%20a%20package%20manager</a></li><li>npm :: <a href="https://docs.npmjs.com/about-npm">https://docs.npmjs.com/about-npm</a></li><li>yarn :: <a href="https://yarnpkg.com/">https://yarnpkg.com/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34965304dc04" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>