<?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 Anshuman Bhardwaj on Medium]]></title>
        <description><![CDATA[Stories by Anshuman Bhardwaj on Medium]]></description>
        <link>https://medium.com/@anshuman-bhardwaj?source=rss-4cd1967791d3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*b0NuBXg6rKFlipAPNq0XLQ.jpeg</url>
            <title>Stories by Anshuman Bhardwaj on Medium</title>
            <link>https://medium.com/@anshuman-bhardwaj?source=rss-4cd1967791d3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 03:10:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anshuman-bhardwaj/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[Add comments to your Docusaurus website in 5 minutes]]></title>
            <link>https://anshuman-bhardwaj.medium.com/add-comments-to-your-docusaurus-website-in-5-minutes-dd9fa593d6f5?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd9fa593d6f5</guid>
            <category><![CDATA[documentation]]></category>
            <category><![CDATA[community-engagement]]></category>
            <category><![CDATA[community]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[document-management]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Tue, 09 May 2023 12:49:41 GMT</pubDate>
            <atom:updated>2023-05-09T15:25:03.223Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*pGwQCdiY4rxSWIJ5.png" /></figure><p><a href="https://docusaurus.io/">Docusaurus</a> is one of the best static site generators for blogs and documentation projects. Docusaurus is backed by the Meta Open Source team and is quite popular among developer communities for great performance and simple setup.</p><p>In this guide, you’ll add comments to your <a href="https://docusaurus.io/">Docusaurus</a> documentation project.</p><h3>Why do I need comments?</h3><h4>For documentation</h4><p>Documentation is the door to your software and its best advocate. It is also one of the most frequent touch-points with your customers. Collecting comments on your documentation, makes customers feel heard, reduces the threshold for issue reporting, and gives your tech writers actionable feedback to work on.</p><h4>For blog</h4><p>A blog is a great opportunity to build and empower developer communities. Enabling comments on your blog welcomes healthy discussions and brainstorming between your community members.</p><h3>Prerequisites</h3><p>Before proceeding with this guide, you must have your Docusaurus project set up locally.</p><p>To collect comments, likes, and dislikes you’ll use <a href="https://www.docsly.dev/">docsly.dev</a>. docsly is a user feedback tool for documentation. You can <a href="https://app.docsly.dev/dashboard">sign up</a> for a free account.</p><h3>Get project credentials</h3><p>To get your project’s publicId, follow these steps:</p><ol><li>Open the <a href="https://app.docsly.dev/dashboard">dashboard</a>.</li><li>Select <strong>development</strong> project from the top navigation bar.</li><li>Go to <strong>Settings</strong> &gt; <strong>API keys</strong> section.</li><li>Click <strong>Copy Public ID</strong>.</li></ol><blockquote><em>You must use the </em><em>publicId from the </em>development<em> project in your dashboard<br> while testing locally.</em></blockquote><h3>Installation</h3><p>Install the latest version of the @docsly/react package using your favorite package manager.</p><pre>pnpm add @docsly/react <br># or <br>yarn add @docsly/react <br># or <br>npm install @docsly/react</pre><h3>Initializing docsly</h3><p>docsly uses <a href="https://docusaurus.io/docs/2.3.1/swizzling#wrapping">swizzling</a> to wrap itself inside the default &lt;Footer /&gt; component provided by Docusaurus.</p><blockquote><em>Wrapping the Footer component doesn’t impact the default behavior. It only lets docsly to enhance the documentation experience.</em></blockquote><p>You need to initialize docsly using the publicId and pathname (to learn more about props, see <a href="https://dev.to/docs/component">component</a> ). In Docusaurus, you can get the pathname using the useLocation hook from @docusaurus/router.</p><p>To initialize docsly,</p><ol><li>Create a new file ./theme/Footer/index.js in the project root.</li><li>Copy the below code and paste it into the newly created file.</li><li>Replace the publicId copied from the <a href="https://app.docsly.dev/">docsly dashboard</a>.</li></ol><pre>// ./theme/Footer/index.js<br>import React from &quot;react&quot;;<br>import Footer from &quot;@theme-original/Footer&quot;;<br>import Docsly from &quot;@docsly/react&quot;;<br>import &quot;@docsly/react/styles.css&quot;;<br>import { useLocation } from &quot;@docusaurus/router&quot;;<br><br>export default function FooterWrapper(props) {<br>  const { pathname } = useLocation();<br>  return (<br>    &lt;&gt;<br>      &lt;Footer {...props} /&gt;<br>      &lt;Docsly publicId=&quot;&lt;copied-from-dashboard&gt;&quot; pathname={pathname} /&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><p>🥳 Your documentation is now ready to collect feedback using docsly.</p><blockquote><em>To avoid misuse of the </em>development<em> project’s private ID, you must create a new project and use its </em><em>publicId when deploying your project.</em></blockquote><h3>Example project</h3><p>We’ve got a Docusaurus template project working with the latest @docsly/react package hosted live at <a href="https://docusaurus.docsly.dev/">docusaurus.docsly.dev</a>.</p><p>You can also check out the code on <a href="https://github.com/Anshuman71/docsly-docusaurus">GitHub</a>.</p><h3>Additional notes</h3><p>By now you must have realized that you can use docsly on any React application. So, what are you waiting for? <a href="https://www.docsly.dev/">Sign up</a> today.</p><p>I’m eager to see your comments.</p><p><em>Originally published at </em><a href="https://dev.to/anshuman_bhardwaj/add-comments-to-your-docusaurus-website-in-5-minutes-3pck"><em>https://dev.to</em></a><em> on May 9, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd9fa593d6f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Tips for Managing a Successful Remote Team]]></title>
            <link>https://anshuman-bhardwaj.medium.com/5-tips-for-managing-a-successful-remote-team-97dfc036ad5f?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/97dfc036ad5f</guid>
            <category><![CDATA[slack-tips-and-tricks]]></category>
            <category><![CDATA[slack-apps]]></category>
            <category><![CDATA[slack]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Sat, 07 Jan 2023 11:19:24 GMT</pubDate>
            <atom:updated>2023-01-07T11:19:24.115Z</atom:updated>
            <content:encoded><![CDATA[<h4>Overcoming the Challenges of Clear Communication in a Virtual Workforce</h4><figure><img alt="Slack tips" src="https://cdn-images-1.medium.com/max/1024/0*bcQKNy6KWNTd8od6" /><figcaption>Photo by <a href="https://unsplash.com/fr/@judmackrill?utm_source=medium&amp;utm_medium=referral">Jud Mackrill</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Managing a remote team can be a challenging but rewarding experience. Without the benefit of face-to-face interaction, clear communication becomes even more important to ensure that everyone is on the same page and working towards the same goals. In this article, we will explore the importance of clear communication in a remote team and provide some tips for effectively managing a team that is working remotely.</p><h3>Building Trust and Rapport through Clear Communication</h3><p>One of the biggest challenges of managing a remote team is the lack of in-person interaction. It can be difficult to build trust and rapport with team members when you are not able to see them on a daily basis. This is where clear communication becomes critical. By being clear and concise in your communication, you can help build trust and ensure that everyone is on the same page.</p><h3>Setting Expectations for a Remote Team</h3><p>One key aspect of clear communication is setting expectations. This is especially important in a remote team, as there may be different time zones and working styles to consider. Clearly outlining the expectations for your team will help ensure that everyone is working towards the same goals and that there is a clear understanding of what is expected of each team member.</p><h3>Being Responsive and Available</h3><p>Being responsive and available is an important aspect of clear communication is be. In a remote team, it is not always possible to have immediate in-person conversations, so it is important to be responsive to messages and inquiries from team members in a timely manner. This will help to keep the team moving forward and ensure that everyone is able to get the support they need.</p><h3>Regular Team Meetings</h3><p>Another effective way to improve communication in a remote team is to have regularly scheduled team meetings. These can be done over video conferencing tools such as Zoom or Google Meet. These meetings allow everyone to come together and discuss progress, address any issues that may have arisen, and plan for the future.</p><h4>One-on-One Check-Ins</h4><p>In addition to team meetings, it can also be helpful to have one-on-one check-ins with each team member. These check-ins can be used to discuss individual performance, address any concerns, and provide support and guidance.</p><h3>Listening and Being Open to Feedback</h3><p>Effective communication is also about listening and being open to feedback. Encourage team members to share their thoughts and ideas, and make an effort to listen actively and consider their perspectives. This will help to create a positive and collaborative team culture.</p><h3>Things to Avoid in Remote Team Communication</h3><h4>Using Jargon or Technical Language</h4><p>In a remote team, it is important to make sure that everyone is on the same page and understands what is being communicated. Using language that is unclear or confusing can create confusion and hinder progress.</p><h4>Sending Long or Difficult-to-Understand Messages</h4><p>Avoid sending emails or messages that are too long or difficult to understand. In a remote team, it is important to be concise and to the point in your communication. Long emails or messages that are difficult to understand can be overwhelming and may not be read or acted upon.</p><h4>Ignoring or Failing to Respond to Messages</h4><p>In a remote team, it is important to be responsive and available to support team members and keep projects moving forward. Failing to respond to messages can lead to misunderstandings and hinder progress.</p><h4>Using Only Email or Text-Based Communication</h4><p>While email and messaging can be useful tools for communication in a remote team, it is important to also incorporate other methods of communication such as video conferencing or phone calls to help build relationships and facilitate more effective communication.</p><p>In conclusion, clear communication is essential for the success of a remote team. By setting expectations, staying responsive and available, using the right tools, and being open to feedback, you can effectively manage your remote team and ensure that everyone is working towards the same goals. With the right strategies in place, a remote team can be just as effective and cohesive as a traditional in-office team.</p><p>If you’re looking for a tool to help improve communication and collaboration within your team, consider using <a href="https://useglossary.com/">Glossary</a> — a free Slack bot that automatically expands acronyms, improving communication and saving time. No more waiting for explanations or repeating explanations — just check the thread with Glossary!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97dfc036ad5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 Tips for Effective Communication on Slack]]></title>
            <link>https://anshuman-bhardwaj.medium.com/7-tips-for-effective-communication-on-slack-7dff58ef2299?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dff58ef2299</guid>
            <category><![CDATA[slack-apps]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[slackbot]]></category>
            <category><![CDATA[slack-tips-and-tricks]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Mon, 26 Dec 2022 14:40:38 GMT</pubDate>
            <atom:updated>2022-12-26T14:40:38.952Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to Collaborate Effectively with Your Team</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jgdF3sAlfhapdkHt" /><figcaption>Photo by <a href="https://unsplash.com/@krakenimages?utm_source=medium&amp;utm_medium=referral">krakenimages</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Effective communication is crucial for the success of any team, and Slack is a popular platform that allows teams to communicate and collaborate remotely. While Slack can be a convenient and efficient communication method, it can also be overwhelming if not used correctly. Here are some tips to help you communicate effectively through Slack:</p><h3><strong>Use clear and concise language</strong></h3><p>When writing a message on Slack, be sure to use clear and concise language. Avoid using jargon or technical terms that may not be familiar to all team members. Consider using bullet points or numbered lists to organize your thoughts and make them easier to read.</p><h3><strong>Use mentions sparingly</strong></h3><p>@mentions are a useful way to get someone’s attention, but if used excessively, they can become annoying and disruptive. Only use @mentions when it is necessary to involve someone in a conversation or to alert them to something important. If you need to send a message to multiple people, you can use a private group instead of @mentioning each person individually.</p><h3>Use threading to keep conversations organized</h3><p>Threading is a feature that allows you to reply to a specific message in a conversation. This helps to keep conversations organized and easier to follow, especially when multiple people are involved in a conversation. To start a thread, simply click the “Start a thread” button next to the message you want to reply to.</p><h3>Use emojis and reactions to add context</h3><p>Emojis and reactions can add context and personality to your messages. For example, you can use the “thumbs up” emoji to indicate approval or the “question mark” emoji to ask for clarification. Just be sure not to overuse emojis, as they can become distracting.</p><h3>Use direct messages for private conversations</h3><p>If you need to have a private conversation with someone, use a direct message (DM) instead of a public channel. This helps to keep sensitive information confidential and allows you to have a more focused conversation without distractions.</p><h3>Use the “remind” feature to stay on track</h3><p>Slack has a “remind” feature that allows you to set reminders for yourself or for others. This can be useful for keeping track of tasks, deadlines, or important conversations. Simply type “/remind” followed by the message and the time you want the reminder to be sent.</p><h3>Use the “search” feature to find information</h3><p>Slack has a powerful <a href="https://slack.com/intl/en-in/help/articles/202528808-Search-in-Slack">search feature</a> that allows you to find messages and files quickly. You can use keywords or filters to narrow down your search results. This can be especially useful when you need to refer back to an old conversation or find a specific file.</p><p>Following these tips can improve your communication skills on Slack and help your team work more effectively.</p><p>If you’re looking for a tool to help improve communication and collaboration within your team, consider using <a href="https://useglossary.com/">Glossary</a> — a Slack bot that expands acronyms and abbreviations for clear communication. No more waiting for explanations or repeating explanations — just check the thread with Glossary!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dff58ef2299" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Strategies for Improving Communication in Slack: Tips and Tools to Increase Productivity]]></title>
            <link>https://anshuman-bhardwaj.medium.com/5-strategies-for-improving-communication-in-slack-tips-and-tools-to-increase-productivity-ab5e268fba0f?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab5e268fba0f</guid>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[slackbot]]></category>
            <category><![CDATA[slack-tips-and-tricks]]></category>
            <category><![CDATA[slack-apps]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Tue, 20 Dec 2022 14:28:10 GMT</pubDate>
            <atom:updated>2022-12-20T14:28:10.355Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*htqpcsm4H90RILN3" /><figcaption>Photo by <a href="https://unsplash.com/@schmaendels?utm_source=medium&amp;utm_medium=referral">Andreas Klassen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Effective communication is essential for any team, and Slack has become a popular tool for teams to stay connected and collaborate. However, Slack can quickly become overwhelming without proper organization and strategies in place and hinder rather than improve communication. Here are the top five ways to improve communication in Slack:</p><h3>1. Use channels wisely</h3><p>One of the key features of Slack is the ability to create channels for different projects or teams. This is a great way to keep conversations organized and reduce clutter in your main channel. However, it’s important to use channels wisely and not create too many. Consider making a channel for each project or team rather than one for every topic. This will help team members quickly find the information they need and stay focused on what’s important.</p><h3>2. Set clear expectations</h3><p>Establishing guidelines for communication in Slack is crucial for ensuring that essential messages are not missed and that team members know how to communicate effectively. This could include when to use @mentions, when to use direct messages, and what type of content is appropriate for each channel. You may also want to set expectations around response times, particularly if team members are working in different time zones.</p><h3>3. Use threads</h3><p>As conversations in Slack can quickly become cluttered, using threads can be a helpful way to keep things organized. If a conversation is starting to get off-topic, consider using threads to break it up and keep the main channel focused on important updates and conversations. This will help team members easily find the information they need and avoid getting overwhelmed by too much information.</p><h3>4. Use integrations</h3><p>Slack offers a wide range of integrations with other tools such as Trello, Asana, and Google Drive. These integrations can help streamline communication and collaboration, allowing team members to easily access and update project information from within Slack. For example, you can use the Trello integration to see updates on tasks, assign tasks to team members, and add comments, all within Slack.</p><h3>5. Take breaks</h3><p>It’s important to remember to step away from Slack and take breaks from screens to recharge and refocus. Encourage team members to do the same to avoid burnout and maintain productivity. You can use Slack’s “do not disturb” feature to set specific times when you don’t want to receive notifications, or consider setting aside certain times of the day as “tech-free” times to disconnect and focus on other tasks.</p><p>In addition to these strategies, there are a few other things you can do to improve communication in Slack:</p><ul><li><strong>Use emojis</strong>: Emojis can be a fun and effective way to add context and tone to your messages. However, be mindful of cultural differences and make sure to use emojis appropriately.</li><li><strong>Use formatting</strong>: Slack offers a range of formatting options, including bold, italic, and strikethrough, to help you emphasize important points or add clarity to your messages.</li><li><strong>Use search</strong>: Slack’s search function is a powerful tool that allows you to quickly find messages, files, and conversations. This can be especially helpful if you need to reference something from the past or if you’re looking for something specific.</li><li><strong>Use integrations</strong>: As mentioned above, Slack offers a wide range of integrations with other tools that can help streamline communication and collaboration. Consider what tools your team is already using and see if there are any Slack integrations that could make your workflow more efficient.</li></ul><p>You can create a more organized and efficient workspace by implementing these strategies and taking a few extra steps to improve communication in Slack. By establishing clear expectations, using channels wisely, and taking breaks to recharge, you can help your team stay focused and productive.</p><p>If you’re looking for a tool to help improve communication and collaboration within your team, consider using <a href="https://useglossary.com/">Glossary</a> — a Slack bot that expands acronyms and abbreviations for clear communication. No more waiting for explanations or repeating explanations — just check the thread with Glossary!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab5e268fba0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Send Login Notifications to Users using Auth0 Actions]]></title>
            <link>https://javascript.plainenglish.io/how-to-send-login-notifications-to-users-using-auth0-actions-8798597dfb5?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8798597dfb5</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[auth0]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Sun, 21 Aug 2022 13:25:01 GMT</pubDate>
            <atom:updated>2022-08-24T07:17:50.479Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Vtyzh75W1caZwvdmKYhkA.png" /><figcaption>Sending login notifications to users using Auth0 Actions</figcaption></figure><p>You can never be too sure about your security on the internet. The good news is that most companies are becoming proactive in preventing hacking attempts on users by notifying them about suspicious login activity. Some banks even go as far as informing users about every login attempt, and I like it.</p><p>At this point, most users have gotten at least one email from services like Gmail or Twitter telling them about a login activity on their account, something like the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*VE-jnBEWzL82taO_.png" /></figure><p>In this article, you’ll learn how to set up something similar for your application using <a href="https://auth0.com/blog/introducing-auth0-actions/">Auth0 Actions</a>. Auth0 Actions are JavaScript functions that you can plug in at different stages of the authentication flow, such as user sign-up, login, and reset password to extend the default functionality. Auth0 Actions allow you to use third-party libraries and store secrets to use within your code.</p><p>You might have guessed already where I’m going with this but let me paint a picture for you ( <em>literally</em>). The Auth0 Action will execute after the login is initiated and send an email just before finishing up the login flow, as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*fvHxqfSRGNIenBhP.png" /></figure><p>In this example, the action will notify the user with an email, but you can also do an SMS or anything-the sky is the limit, my friend.</p><h3>Prerequisite</h3><p>To follow along with this example, you need an Auth0 account. You can <a href="https://a0.to/signup-for-auth0">sign up for a free one</a> if you haven’t got one. You’ll also need an email sending service such as <a href="https://sendgrid.com/">Sendgrid</a> to send an email.</p><h3>Set up Auth0 Action</h3><p>To set up an action,</p><ol><li>Open your Auth0 dashboard</li><li>Select the <strong>Actions &gt; Flows</strong> option in the left navigation bar and click on <strong>Build Custom</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*NdHtmDQkDR2aa51Q.png" /></figure><p>3. Fill out the Create Action *<strong>*form as shown below and click on the **Create</strong> button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*sJBji26txvx0y1Tr.png" /></figure><p>4. Add the @sendgrid/mail npm package to the dependency section of the editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*XuQrPUpsuG_j40Sl.png" /></figure><p>5. Add the SENDGRID_API_KEY to the secrets section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*BhrXCs5W2uuYRnKy.png" /></figure><p>6. Update the onExecutePostLogin function in the code editor as below. The event object provides the required information such as the stored secrets, email, name, IP address of the device used, and geolocation. You can read more about the event object in the <a href="https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object">documentation</a>.</p><pre>exports.onExecutePostLogin = async (event) =&gt; {<br>  const sgMail = require(&#39;@sendgrid/mail&#39;)<br>  sgMail.setApiKey(event.secrets.SENDGRID_API_KEY)<br>  const { user, request } = event;<br>  const { ip, geoip } = request;<br>  const msg = {<br>    to: user.email, // Change to your recipient<br>    from: &quot;f@theanshuman.dev&quot;, // Change to your verified sender<br>    subject: `Recent login from ${geoip.cityName}, ${geoip.countryCode}`,<br>    html: `Hi ${user.name}, your account has been logged in recently from &lt;b&gt;${geoip.cityName}&lt;/b&gt;, &lt;b&gt;${geoip.countryCode}&lt;/b&gt; from IP address &lt;b&gt;${ip}&lt;/b&gt;.`,<br>  };<br>  sgMail<br>    .send(msg)<br>    .then(() =&gt; console.log(&quot;Sent successfully&quot;))<br>    .catch((err) =&gt; {<br>      console.log(err);<br>    });<br>};</pre><p>7. Click on the <strong>Deploy</strong> button to activate the action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*1kS-fxiOMq4o4W0m.png" /></figure><p>8. It’s time to test the action. Log into your application</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*eBMHBokk9LTIinsI.png" /></figure><p>9. You can open the <strong>Monitoring &gt; Logs</strong> section inside the Auth0 dashboard to see Actions execution details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*EFywh8mPML7p3V-V.png" /></figure><h3>Conclusion</h3><p>In this article, you learned about Auth0 Actions and how easily you can create one to send login notifications to your users. Auth0 is a leading authentication and authorization platform that provides developers with features such as social logins, user management, and passwordless logins. You can <a href="https://a0.to/signup-for-auth0">sign-up</a> for free on Auth0 to try this example or experiment with one of your own.</p><p>I hope you find this article helpful! Should you have any feedback or questions, you can put them in the comments below. For more such articles, follow me on <a href="https://twitter.com/sun_anshuman">Twitter</a>.</p><p><em>Until next time!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*BIsddI0XLW7qdiuo.gif" /></figure><p><em>Originally published at </em><a href="https://dev.to/anshuman_bhardwaj/sending-login-notifications-to-users-using-auth0-actions-153e"><em>https://dev.to</em></a><em> on August 21, 2022.</em></p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8798597dfb5" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-send-login-notifications-to-users-using-auth0-actions-8798597dfb5">How to Send Login Notifications to Users using Auth0 Actions</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction to Next.js for Beginners]]></title>
            <link>https://javascript.plainenglish.io/an-introduction-to-next-js-for-beginners-b15d02103369?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/b15d02103369</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Mon, 18 Apr 2022 07:18:04 GMT</pubDate>
            <atom:updated>2022-09-29T16:30:05.479Z</atom:updated>
            <content:encoded><![CDATA[<h4>The only Next.js guide you&#39;ll need</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HzjmOhJns_BT7QME.png" /></figure><p><strong>Next.js</strong> is already a widely known framework for React applications when writing this article. Honestly, there are tons of reasons for it to be popular and widely adopted, but I&#39;m not going to go into that rabbit hole for today (I&#39;ve<em> done it many times already</em> 😎). Instead, I&#39;ll walk you through a series of questions (don&#39;t<em> worry, I&#39;ll answer them with you</em>) to explain it better.</p><p><strong><em>Disclaimer</em></strong><em>: When I say for </em>beginners<em> I mean beginners in </em><strong><em>Next.js</em></strong><em>. This article is meant for developers who have been doing React for a while and who want to get serious in Application development with React. So, if you don’t know the fundamentals of React, reading up </em><a href="https://reactjs.org/docs/getting-started.html"><em>React Docs</em></a><em> instead would be a good idea.</em></p><p>If you&#39;ve decided to proceed, let&#39;s get the party started.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*W0uF_9jzK08UCv-V.gif" /></figure><h3>What&#39;s Next.js?</h3><p><strong>Next.js</strong> is a React <em>framework</em> that provides additional optimizations and configurations out-of-the-box for developers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*vDOmtNfMU0VOcyga.gif" /></figure><p><em>But, what does that mean?</em></p><p>To answer this better, we should answer another question first.</p><h3>Why is Next.js?</h3><p>The answer to this question starts with &quot;What is React?&quot;, ( <em>man, now you&#39;re just going in circles</em>), bear with me, my friend.</p><p><em>React is a </em>library<em> for building web applications in a declarative fashion.</em></p><p>React does many things for us. It also has great community and support, but it lacks &quot;opinion.&quot; It&#39;s a <em>library</em>, so it&#39;s minimal by definition and leaves a lot of heavy lifting on the developers, like routing, asset management, and optimizations like code splitting. While this gives flexibility, it also leads to bad choices and poor application organization.</p><p>This is where <strong>Next.js</strong> comes into the picture. It gives the right set of tools and guides you with a process to make the most out of them.</p><p>It provides built-in support for</p><ul><li>Directory-based routing</li><li>Pre-rendering to HTML for SEO (Search engine optimization) <br>- SSR (server-side rendering at request time)<br>- SSG (static site generation at build time)</li><li>API routes</li><li>Middlewares</li><li>Image optimization</li><li>Code splitting</li></ul><p>to name a few.</p><p>It does all of this while keeping</p><ul><li>developer experience optimal</li><li>maintenance overhead to a minimum</li></ul><h3>How&#39;s Next.js?</h3><p>Wait, wait… before you get started about my bad English ( <em>because you didn&#39;t watch Avengers: Infinity War</em>), I&#39;d request you watch <a href="https://www.youtube.com/watch?v=VIoYMIDB_iU">this video</a> to get the joke (that&#39;s important to me 😅).</p><p>Coming back to the question, <strong>Next.js</strong> does it by covering up the things developers want while building upon what React has provided. For example, React is excellent at developing applications with declarative code, but it lacks routing ( <em>as it doesn&#39;t have its own</em>). <strong>Next.js</strong> provides a perfect solution for path-based routing.</p><p><strong>Next.js</strong> became quite popular by solving the SEO problem with client-side applications, including React.</p><p>Ideally, React applications are rendered on the client/browser, which has a couple of drawbacks like</p><ul><li>slow initial load due to large bundle size and JavaScript execution on the client</li><li>bad SEO due to client-side rendering</li><li>unnecessary network calls from the client side leading to a network waterfall</li></ul><p><strong>Next.js</strong> solves this by pre-rendering React applications before sending the response to the user.</p><p><em>Pre-rendering is compiling React components into their HTML layout on the server-side.</em></p><p>Pre-rendering makes the user experience better as:</p><ul><li>it delivers a smaller JavaScript bundle, which reduces the time to download and process it on the client-side</li><li>rendering on the server is fast because of better computing power</li><li>data-fetching on the server saves us from network calls waterfall on the client. On top of that, it&#39;ll be much quicker if the data source is the <strong>Next.js</strong> API routes.</li></ul><p><strong>Next.js</strong> provides two methods of doing pre-rendering: <em>SSR</em>, which generates the HTML at the request time (good for pages using live data), and <em>SSG</em>, which produces the HTML at the build time (better for static pages).</p><p>The below diagram explains the difference between <em>CSR</em> (Client Side Rendering) versus <em>SSR</em> (Server Side Rendering) versus <em>SSG</em> (Static Site Generation):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*bYRDi02rzJVzQj7X.png" /></figure><p>Both <em>SSR</em> and <em>SSG</em> enable us to leverage the simplicity of React without compromising on user experience. <strong>Next.js </strong>being the great framework, picks the best rendering strategy for you based on how you&#39;ve structured your page—making <strong>Next.js</strong> a robust framework for delivering production-ready applications with React.</p><p>You can already see my love for <strong>Next.js</strong> (<em>very hard to hide</em>). I&#39;ll be unleashing this love by continuing this <strong>Next.js</strong> beginners course in articles and <a href="https://www.youtube.com/AnshumanBhardwaj">YouTube</a> videos. <br>We&#39;ll discuss <strong>Next.js</strong> fundamentals in detail and build a production-ready application with <strong>Next.js,</strong> including development and deployment. So, make sure to follow me to get the latest updates.</p><p>I hope you find this article helpful! Should you have any feedback or questions, you can put them in the comments below. For more such articles, follow me on <a href="https://twitter.com/sun_anshuman">Twitter</a>.</p><p><em>Until next time!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*sRMP5W0ZuLCRetm9.gif" /></figure><p><em>Originally published at </em><a href="https://theanshuman.dev/articles/nextjs-explained-for-beginners-c2g"><em>https://theanshuman.dev</em></a><em> on April 18, 2022.</em></p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><em> and </em><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Join our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b15d02103369" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/an-introduction-to-next-js-for-beginners-b15d02103369">An Introduction to Next.js for Beginners</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 ways to declare variables in JavaScript: var, let, and const explained]]></title>
            <link>https://javascript.plainenglish.io/3-ways-to-declare-variables-in-javascript-var-let-and-const-explained-a0ba3c0b17e1?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0ba3c0b17e1</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Mon, 11 Apr 2022 07:05:38 GMT</pubDate>
            <atom:updated>2022-09-29T16:31:03.573Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSzReDJjm_jr5iXyjEBEqg.png" /></figure><p>At the time of writing this article, there are only <em>two</em> popular ways of declaring variables in JavaScript: let and const; poor var is long lost in the darkness of misunderstood principles.</p><p>The idea behind writing this article is to try and clear up the air around why new developers are skeptical about using var and every time I ask this question in an interview, all I get to hear is &quot;var is bad&quot;, &quot;var makes global variables&quot;, blah blah blah.</p><h3>tl;dr</h3><ul><li>var is function scoped, that is it&#39;ll only be accessible in the scope of the function it&#39;s declared in.</li><li>let and const are block-scoped, that is they&#39;ll only be accessible in the scope of the block they&#39;re declared in.</li></ul><p>Those who are looking for a deeper explanation should continue reading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*8waRx7-J8pDAYP-K.gif" /></figure><h3>var</h3><p>var has been around since the beginning of time (just kidding, I think even before that). Some characteristics of a variable declared using var:</p><ul><li>It is function scoped when defined inside one otherwise is globally scoped.</li><li>It can be re-declared in the same scope without throwing an error (even in strict mode).</li><li>It can be re-assigned.</li><li>It can be used before the declaration line in code (although the value will be undefined).</li></ul><pre>console.log(test); // undefined<br><br>var test = &quot;512&quot;;<br><br>console.log(test); // 512</pre><p>Because the interpreter sees this code like:</p><pre>var test; // undefined is the default value<br>console.log(test); // undefined<br>test = &quot;512&quot;<br>console.log(test); // 512</pre><h3>const and let</h3><p>The behavior of const and let is the same other than the fact that variables declared using const cannot be re-assigned.</p><p>Some characteristics of variables declared using const and let:</p><ul><li>They are block-scoped when defined inside one otherwise is globally scoped.</li><li>They cannot be re-declared.</li><li>Variables declared using let can be re-assigned but not const.</li><li>They cannot be used before the declaration line in code (Reference error is thrown because variables are not a given default value).</li></ul><pre>console.log(test); // ReferenceError: Cannot access &#39;test&#39; before initialization<br><br>var test = &quot;512&quot;;<br><br>console.log(test);</pre><h3>Conclusion</h3><p>Every tool is built for serving some purpose, we should utilize for it’s goodness and not just follow the herd in criticizing it.</p><p>I’ll be writing another article explaining how we can best use these tools.</p><p>That’s it for this one. I hope you find this article helpful! Should you have any feedback or questions, please feel free to put them in the comments below. For more such articles, please follow me on <a href="https://twitter.com/sun_anshuman">Twitter</a>.</p><p>Until next time!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*FVVnaqjMa4A7-O1_.gif" /></figure><p><em>Originally published at </em><a href="https://theanshuman.dev/articles/3-ways-to-declare-variables-in-javascript-var-let-and-const-explained-45am"><em>https://theanshuman.de</em>v</a> <em>on April 11, 2022.</em></p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><em> and </em><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Join our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0ba3c0b17e1" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/3-ways-to-declare-variables-in-javascript-var-let-and-const-explained-a0ba3c0b17e1">3 ways to declare variables in JavaScript: var, let, and const explained</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Right Way to Use LocalStorage in JavaScript]]></title>
            <link>https://javascript.plainenglish.io/the-right-way-to-use-localstorage-in-javascript-4e6e24be5ec1?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e6e24be5ec1</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[javascript-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Mon, 28 Mar 2022 12:26:05 GMT</pubDate>
            <atom:updated>2022-09-29T16:32:54.135Z</atom:updated>
            <content:encoded><![CDATA[<h4>LocalStorage API explained in under 5 minutes</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qKvxVZ3icNFgriPKH-z3ww.png" /></figure><p>Being web developers we all have been into a situation, where we want to persist a piece of information like user data, theme preference, or the selected filters, to give our users a consistent experience across browser sessions.</p><p>Well, that’s exactly where the LocalStorage API comes into the picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*JXto_IEuewQLwm8V.gif" /></figure><p>Hold on, hold on! Let’s start from the basics</p><h3>What is LocalStorage?</h3><p>The LocalStorage API of web browsers allows to store and then read the stored data across browser sessions.</p><p>Let’s break it down:</p><ul><li>It allows us to store data into persistent memory so that the data is still available when we restart the browser or even the computer.</li><li>It stores the data locally to that origin, meaning you can only read/write the data to LocalStorage for the current origin i.e the following combination (protocol+domain+port)</li></ul><p><em>It is to be noted that the LocalStorage starts empty and the items added during a private session get cleared as soon as the last private tab is closed.</em></p><h3>Internals of LocalStorage</h3><p>The LocalStorage is a key-value store, meaning it stores the given value against the provided key, just like a JavaScript object but <em>persistent</em>.</p><p>Key-Value store provides fast lookup and writes because of its structure finding the right element will always take constant time (apart from the time to do I/O). This means having hundreds of keys in your LocalStorage wouldn’t slow down the lookup. <em>(Not sure why you would be doing that.)</em></p><p>With its speed comes one limitation, the key and value both have to be a string to be stored in the LocalStorage.<br> Well, this isn&#39;t so hard to get around.</p><p><em>Currently, the Web Storage specification allows you to store up to 5MB per app per browser.</em></p><h3>How to use LocalStorage?</h3><p>Thankfully the LocalStorage API is fairly simple to interface with.</p><p>Let’s go ahead and see how we can do the basic operations like Create/Read/Update/Delete on LocalStorage,</p><h3>Writing data</h3><p>The localStorage.setItem() accepts a string as key and the value is also accepted as a string.</p><pre>localStorage.setItem(&#39;&lt;key&gt;&#39;, &#39;&lt;value&gt;&#39;)</pre><p>The above line of code will write the value against the given key, if the already exists, the existing value will be overwritten.</p><h3>Reading data</h3><p>To read the stored information, we need to provide the key</p><pre>const value = localStorage.getItem(&#39;&lt;key&gt;&#39;)<br>// value will be null or string</pre><p>null is returned if no data is found with the given key.</p><h4>Storing Objects in LocalStorage</h4><p>You might be wondering, “Strings! Jeez, what am I going to do about an object?” Don’t worry.</p><p>We are still allowed to store a serialized version of the object,</p><pre>    // storing an object in LocalStorage<br>    const user = { name: &#39;anshuman_bhardwaj&#39; }<br>    localStorage.setItem(&#39;user&#39;, JSON.stringify(user))</pre><pre>    // reading the object from LocalStorage<br>    const strinifiedUser = localStorage.getItem(&#39;user&#39;)<br>    if(strinifiedUser) {<br>      const retrivedUser = JSON.parse(strinifiedUser)<br>    }</pre><h3>Deleting data</h3><p>There are two methods for removing stored data from LocalStorage programmatically</p><h4>removeItem</h4><p>If you already know which item to delete, removeItem is the way to go.</p><pre>localStorage.removeItem(&#39;&lt;key&gt;&#39;)</pre><h4>clear</h4><p>If you want to remove all keys from the storage, then clear is a <em>clear</em> choice. (you see what I did there?)</p><pre>localStorage.clear()</pre><p>As exciting as it may sound, the clear method shouldn&#39;t be used all that much because it clears <strong>everything</strong> and not just the items that <em>you</em> added.</p><p>This means if you are interacting with services that use LocalStorage e.g. authentication modules like Firebase Auth or Okta, clearing the LocalStorage will also delete the data those services had put in and it’ll break their behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*QX2IYu2bFoebU-v1.gif" /></figure><p>Yeah, don’t worry, I got you.</p><p>In computer science we should always focus on encapsulation, meaning we should hide the information or encapsulate it, so to say. Well, that’s exactly how we are going to solve our little problem here.</p><p><em>The following pattern was suggested to me by my friend &amp; colleague </em><a href="https://www.linkedin.com/in/ryanirilli"><em>Ryan</em></a><em>.</em></p><h3>Creating and using Namespace in LocalStorage?</h3><p>We can apply the principle of encapsulation here by putting all of our data under a predefined &amp; unique key or namespace. This will allow us to hide our from other parts of the application (which we don’t control) and also save us from mistakenly updating the data which we shouldn’t.</p><p>“Sounds good, but how do we do that?”, you might be wondering.</p><p>Well, it’s simpler than it sounds and works by enclosing the whole application state under one single key rather than using a new key for each piece of information.</p><h4>Step 1</h4><p>Create a key, predictable yet unique. A good example would be [your-app-name]+[some-unique-token] i.e. DEV-007</p><h4>Step 2</h4><p>While storing information, we read the namespace value from the LocalStorage, deserialize it, update the value against the key inside the object and then serialize it again before writing to LocalStorage.</p><h4>Step 3</h4><p>While reading the information, we read the namespace value from the LocalStorage, deserialize it and return the value of the key from the object.</p><p><em>This way we treat the namespace like its own little LocalStorage.</em></p><p>Below is a code implementation of the above:</p><pre>const NAMESPACE = &quot;DEV-007&quot;;</pre><pre>function writeToStorage(key, value) {<br>  const serializedData = localStorage.getItem(NAMESPACE);<br>  const data = serializedData ? JSON.parse(serializedData) : {};<br>  data[key] = value;<br>  localStorage.setItem(NAMESPACE, JSON.stringify(data));<br>}</pre><pre>function readFromStorage(key) {<br>  const serializedData = localStorage.getItem(NAMESPACE);<br>  const data = JSON.parse(serializedData);<br>  return data ? data[key] : undefined;<br>}</pre><pre>function clear() {<br>  localStorage.setItem(NAMESPACE, JSON.stringify({}));<br>}</pre><pre>function removeItem(key) {<br>  const serializedData = localStorage.getItem(NAMESPACE);<br>  const data = serializedData ? JSON.parse(serializedData) : {};<br>  delete data[key]<br>  localStorage.setItem(NAMESPACE, JSON.stringify(data));<br>}</pre><p>The above implementation of clear and removeItem is safe to use and solves our issue.</p><p>Don’t worry you will not have to write your own implementation because there exists an npm package <a href="https://www.npmjs.com/package/store2">store2</a> that solves the above problem and provides smarter local storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/0*f3CJ-YpsqbBGsIGd.gif" /></figure><p>That’s all for today. Should you have any questions or suggestions please feel free to drop them in the comments below.<br> For more such content, please <a href="https://twitter.com/sun_anshuman">follow me on Twitter</a></p><p><em>Until next time!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*YDvw3wP4Hzye7hQ2.gif" /></figure><p><em>Originally published at </em><a href="https://theanshuman.dev/articles/the-right-way-to-use-localstorage-in-javascript-41a0"><em>https://theanshuman.de</em>v</a> <em>on March 28, 2022.</em></p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><em> and</em><strong><em> </em></strong><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Join our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e6e24be5ec1" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/the-right-way-to-use-localstorage-in-javascript-4e6e24be5ec1">The Right Way to Use LocalStorage in JavaScript</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What the Heck is SSG? Static Site Generation Explained with Next.js]]></title>
            <link>https://javascript.plainenglish.io/what-the-heck-is-ssg-static-site-generation-explained-with-next-js-63d3a8c2cc1a?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/63d3a8c2cc1a</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Mon, 21 Mar 2022 09:05:12 GMT</pubDate>
            <atom:updated>2022-09-29T16:37:25.981Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FRFZsqVtS11Uf9WN.png" /></figure><p>If you are a web developer and you don’t live under a rock, you must have come across this buzzword called “SSG”.</p><p>In the next 5 minutes, we will learn it down to the basics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*bUBYQc3X--05R8sL.gif" /></figure><h3>What is SSG?</h3><p>Static Site Generation a.k.a. SSG is pre-rendering your React app into HTML at build time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*IFMD2NrLWG7U-Ve5.png" /><figcaption>SSG vs SSR vs CSR</figcaption></figure><p>Let’s break it down. Ideally, your React app is client-side rendered, meaning the user’s browser will first download the complete JavaScript bundle and then execute it before the user can even see any content. Sounds pretty slow huh? It really is.</p><p>Pre-rendering to HTML means that we will convert the React Component to an HTML file and send the HTML file to the client so it can quickly show that to our user without much processing or bandwidth.</p><p>That’s what server-side rendering is, you might be wondering.</p><p>Yes, it is, the <strong>Static</strong> in SSG comes from the fact that this whole process doesn’t happen for each user request (like SSR) instead of at the build time, making SSG even faster than Server-side rendering.</p><p>In short, SSG will make the HTML pages out of a React app at the build time so it doesn’t have to do it for every request, and neither does the browser have to do it on the client-side.</p><h3>Why do we need SSG?</h3><p>SSG exists to serve a specific use case, serving dynamic pages built in React as HTML.</p><p>What’s the benefit you ask?</p><ul><li><strong>SEO</strong>, search engine optimization is one of the top benefits of doing SSG as it makes indexing the pages easy for the crawlers.</li><li><strong>Speed</strong>: As you can guess, serving an HTML page is much faster for the end-user because the browser doesn’t have to do much processing upfront. The pre-rendering makes it easy for the browser to fetch the HTML and render it straight up.</li><li><strong>Caching with CDNs</strong>: Building HTML pages opens the possibility for CDN caching to show its charm. The pages are stored closer to the user globally and hence can be accessed much faster. Every request doesn’t have to wait for the server to render the page, it just receives the page from CDN, saving us compute resources and money.</li></ul><h3>Use case</h3><p>While you can use SSG in any scenario as long as the page can be rendered at the build time, here are some popular use case patterns for SSG</p><ul><li>Marketing websites</li><li>Blogs and documentation, like my own <a href="https://theanshuman.dev/articles">blog</a></li><li>Portfolio websites</li></ul><blockquote><em>Tip: An easy way to know if you should use SSG is by answering: “Can you pre-render the page ahead of a user’s request?” If the answer is yes, then you should choose Static Generation.</em></blockquote><h3>Using Next.js for SSG</h3><p>Building Static pages with Next.js is simple. It works pretty similarly to building any other page i.e by creating a new file in the pages directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/0*fygzahn4pfZ8jiD5.png" /></figure><h4>A static page for a static route</h4><p>Let’s start by creating a static route ./pages/first-ssg.tsx</p><p>Because the page is rendered at the build time, Next.js needs to get all the data before the rendering. Next.js looks for a getStaticProps method exported from the page to run at the build time. This method should return an object with props key, which is passed to the Page component.</p><p>getStaticProps should be used to fetch all the information needed to render the page. For example, if we are making an <em>About company</em> page, getStaticProps is the right place to fetch company details from our API endpoint.</p><pre>// ./pages/first-ssg.tsx<br>import type { NextPage } from &quot;next&quot;;<br><br>export async function getStaticProps() {<br>  // get all the data needed for rendering the page<br>  const data = await fetchPageData();<br>  return {<br>    props: { data },<br>  };<br>}<br><br>const FirstSSG = ({ data }) =&gt; {<br> return (<br>      &lt;main&gt;<br>        {/* more html content */}<br>      &lt;/main&gt;<br> )<br>}<br><br>export default FirstSSG;</pre><blockquote><em>Note: </em><em>getStaticProps does not have access to the incoming request (such as query parameters or HTTP headers) because it runs at the build time and not at the request time.</em></blockquote><h4>A static page for a dynamic route</h4><p>Let’s create a dynamic route ./pages/[id].tsx</p><p>Apart from the getStaticProps for page-specific data, Next.js now also needs to figure out what are all the possible paths for this route, because Next.js will have to render the pages for these paths at the build time.</p><p>For this purpose, Next.js expects a getStaticPaths method which will list down all the possible paths for a dynamic route at the build time. For example, if it is a dynamic blog page we will need to list down all the available blogs as paths.</p><p>The paths returned by getStaticPaths contains a params object which will be passed to the getStaticProps. You can use the params to pass the data about the path, like the blog slug or id, which can later be used by the getStaticProps to get data for the page.</p><pre>// ./pages/[id].tsx<br>import type { NextPage } from &quot;next&quot;;<br><br>export async function getStaticPaths() {<br>  return {<br>    paths: [<br>      { params: { ... } }<br>    ],<br>    fallback: // true or false or &#39;blocking&#39;, to be discussed later<br>  };<br>}<br><br>export async function getStaticProps({ params }) {<br>  // get all the data needed for rendering the page<br>  const data = await fetchPageData(params);<br>  return {<br>    props: { data },<br>  };<br>}<br><br>// Your page layout<br>const FirstSSG = ({ data }) =&gt; {<br> return (<br>      &lt;main&gt;<br>        {/* more html content */}<br>      &lt;/main&gt;<br> )<br>}<br><br>export default FirstSSG;</pre><p>That’s all you need to do in order to build a Static website using Next.js.</p><p>It can’t be all rosy, can it? Let’s talk about some pitfalls.</p><h3>Pitfalls</h3><ol><li>One of the biggest drawbacks of this approach is the build time. If you have thousands of pages, building all of them will take a lot of time. I know there are solutions like <em>Incremental Static Regeneration</em> and fallback prop, which can be used in conjunction to get around this. We&#39;ll see this in a bit.</li><li>Another problem that can arise is outdated pages. Because you get the page data at build time, the data might be stale after some time. So you might have to schedule builds or trigger them at specific intervals to make sure data is the latest. This can also be resolved with <em>Incremental Static Regeneration</em>. However, if this is the case you should probably think about Server-side rendering and not Static pages for this route.</li></ol><h3>The fallback option</h3><p>As we discussed above, there is a fallback option that can be returned from the getStaticPaths and it is used for the paths which were not in the paths list returned from getStaticPaths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*ztzN9DYskckAq9sE.png" /></figure><blockquote><em>It is important to understand the fallback option will not regenerate or update paths which were rendered at the build time instead it only works for the path not pre-rendered at build time.</em></blockquote><p>The fallback option can be extremely useful for apps with thousands of pages, making build time fast while keeping the user experience at best.</p><h3>Why Next.js?</h3><p>I prefer Next.js because it provides both the options,</p><ol><li>Server-side rendering</li><li>Static site generation</li></ol><p>So, I can choose while writing the page which way I want to go.</p><p>It also provides great integration with the Vercel cloud platform which allows edge-caching and CI/CD for free.</p><p>That’s it for this one. I’ll be writing another article explaining <em>Incremental Static Regeneration</em> soon. I hope you find this article helpful! Should you have any feedback or questions, please feel free to put them in the comments below. For more such articles, please follow me on <a href="https://twitter.com/sun_anshuman">Twitter</a></p><blockquote><em>Until next time</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*VOq-0y3svMhT1ySO.gif" /></figure><p><em>Originally published at </em><a href="https://theanshuman.dev/articles/create-your-own-url-shortener-with-nextjs-and-mongodb-in-10-minutes-4fg"><em>https://theanshuman.de</em>v</a> <em>on March 21, 2022.</em></p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><em> and </em><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Join our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63d3a8c2cc1a" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/what-the-heck-is-ssg-static-site-generation-explained-with-next-js-63d3a8c2cc1a">What the Heck is SSG? Static Site Generation Explained with Next.js</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Worst Things You Can Do in an Interview]]></title>
            <link>https://javascript.plainenglish.io/3-worst-things-you-can-do-in-an-interview-25bf1ae5b9c0?source=rss-4cd1967791d3------2</link>
            <guid isPermaLink="false">https://medium.com/p/25bf1ae5b9c0</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Anshuman Bhardwaj]]></dc:creator>
            <pubDate>Tue, 15 Mar 2022 06:31:57 GMT</pubDate>
            <atom:updated>2022-09-29T16:38:07.190Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hc2IppGcoRyTKK1p" /><figcaption>Photo by <a href="https://unsplash.com/@mimithian?utm_source=medium&amp;utm_medium=referral">Mimi Thian</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>While I was at <a href="https://canoo.com/">Canoo</a>, I took around 100 interview calls, ranging from technical screening to behavioral &amp; culture fit tests. I met some great candidates and some who really disappointed me. In this article, we will take a look at <strong>three</strong> of the worst things I’ve seen in an interview that you should avoid doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*RwAB7wg2AO2VdOu7.gif" /></figure><h3>Being clueless</h3><p>Let me add to it, being clueless about:</p><ul><li>The company</li><li>The role</li><li>The skillset required</li></ul><p>One gentleman I was interviewing last summer showed up at the interview without even knowing what the heck Canoo is doing.</p><p>It was shocking for me because you’re sitting in front of a person who probably has spent months preparing for the interview but doesn’t know anything about the company.</p><p>How many times has it happened that you looked at the job title and just applied straight away?</p><p>Don’t lie, it happens, I know. It used to happen to me when I was starting out my career. I used to desperately apply for jobs without even checking the job description, let alone the company details.</p><p>Over the years I’ve realized that it’s important for you to:</p><ul><li>Understand the role, most companies put a “first 90 days goal” or similar road map in their job posting which should help you understand more about the role and day-to-day working of the team.</li><li>Understand the company mission and its values you should always read up about the company you’re applying to. I check the company website, and most of them have an <em>About</em> section or <em>Careers</em> section which tells a lot about the company values and priorities. Some good companies even have their own blog which will give you a good insight into the company.</li></ul><h3>Being unprofessional</h3><p>This goes without saying that one should behave professionally when in an interview, and if you’re like me you’d be shocked to see people <em>yawning</em> in an interview.</p><p>Last year, I talked to one person who had the camera setup below his face, giving a weird angle, and was constantly scratching his back. He was looking as if he doesn’t care about the interview. No matter how good he was at coding, I didn’t see my team working with someone so lazy or unprofessional.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*CyDeL6Q0QdE8jkeT.gif" /></figure><p>Let’s get it straight, being fun !== being unprofessional.</p><p>When I speak of professionalism, I don’t mean you should be wearing a suit, but at least you shouldn’t show up yawning in an interview.</p><p>No matter how much you hate this but an interviewer only has 30–40 minutes to get an impression from you. I know this sounds crazy but the 30 minutes call you get with them is your chance to show how amazing you are, how well you can communicate and express your opinions, how you present yourself and your arguments.</p><p><em>Always remember, you only have this one call to make a good impression because they don’t know you outside of this very call (unless you already have built a social brand for yourself).</em></p><h3>Being ignorant</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*k2Xn0Z7RlNTqsopq.gif" /></figure><p>This January, I was taking a technical screening call with a candidate. She was smart and confident at the beginning of the conversation but soon that got overshadowed by how ignorant and defensive she got on feedback to her answers. This made me a little concerned about her being a team player and I asked a couple of more questions to see how she handles more such questions. It felt like she was ignoring my input and constantly trying to prove that she was correct.</p><p>Not just her, the person I was talking about in the last section was also somewhat like her. He didn’t take the suggestions and feedback on how he could’ve done better. Instead, he started talking defensively, ignoring and making an annoyed face.</p><p>It’s alright to be annoyed, but I think in a team you’ll be annoyed at some point. We all need to learn how to handle such situations and communicate well without letting our egos take over.</p><p>Looking back, I’m sure I’ve made similar mistakes in the past but I was lucky enough to have more patient interviewers. I’ve learned my lessons and the biggest one is, to accept mistakes honestly and try to learn from them. Being humble about your mistakes will get you respect and constructive feedback.</p><p>That’s it for now. I hope you find this article helpful! Should you have any feedback or questions, please feel free to put them in the comments below. For more such articles, please follow me on <a href="https://twitter.com/sun_anshuman">Twitter</a>.</p><p>Until next time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/245/0*OS6IHrI4HqaZFxzf.gif" /></figure><p><em>Originally published at </em><a href="https://theanshuman.dev/articles/3-worst-things-to-do-in-an-interview-j01"><em>https://theanshu</em>man.dev</a> <em>on March 15, 2022.</em></p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><em> and </em><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>. Join our </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>community Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25bf1ae5b9c0" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/3-worst-things-you-can-do-in-an-interview-25bf1ae5b9c0">3 Worst Things You Can Do in an Interview</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>