<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Asm Raihan</title>
    <description>The latest articles on Forem by Asm Raihan (@asmraihan).</description>
    <link>https://forem.com/asmraihan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1054523%2F598af55b-e57c-4f6e-be56-ee3c64f33a16.jpg</url>
      <title>Forem: Asm Raihan</title>
      <link>https://forem.com/asmraihan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/asmraihan"/>
    <language>en</language>
    <item>
      <title>🔐 Lucia Auth: A Flexible Open Source Authentication Library for the JavaScript Ecosystem! 🔐</title>
      <dc:creator>Asm Raihan</dc:creator>
      <pubDate>Fri, 05 Apr 2024 11:50:55 +0000</pubDate>
      <link>https://forem.com/asmraihan/lucia-auth-a-flexible-open-source-authentication-library-for-the-javascript-ecosystem-18m5</link>
      <guid>https://forem.com/asmraihan/lucia-auth-a-flexible-open-source-authentication-library-for-the-javascript-ecosystem-18m5</guid>
      <description>&lt;p&gt;&lt;em&gt;For years, I was tired of wrestling with overly complex authentication libraries.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Building my own authentication system needed much more care than I could ever imagine. Lucia comes with a simple, flexible, and type-safe authentication library designed for Astro, Express, Next.js, Nuxt, SolidStart, SvelteKit, and more! 🚀&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Lucia?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unlike other third-party authentication libraries like Clerk, NextAuth, or Supabase auth, Lucia takes a different approach. It's not a one-size-fits-all solution. Instead, Lucia empowers you to create authentication tailored precisely to your app's needs. No hidden configurations or callbacks that force you into a corner.&lt;/p&gt;

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

&lt;p&gt;✅ Own your data with full control&lt;/p&gt;

&lt;p&gt;✅ Secure with a focus on user privacy&lt;/p&gt;

&lt;p&gt;✅ MIT license for open development&lt;/p&gt;

&lt;p&gt;✅ Fully typed for TypeScript lovers&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Does Lucia Stand Out?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Flexibility&lt;/strong&gt;: Customize your sign-in forms and APIs the way you want.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Integration&lt;/strong&gt;: Direct support for Next.js, SvelteKit, and Astro SSR.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Database Support&lt;/strong&gt;: Adapters for MySQL, Postgres, Sqlite, MongoDB, and Redis.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Custom User Attributes&lt;/strong&gt;: Set any user attributes, similar to Firebase custom claims.&lt;/p&gt;

&lt;p&gt;🔹 &lt;strong&gt;Low-Level Control&lt;/strong&gt;: Manage user and session data easily.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import { Lucia } from "lucia";

const lucia = new Lucia(new Adapter(db));

const user = await lucia.createUser("email", userEmail, {
 password: userPassword,
 attributes: {
  username: userUsername
 }
});

const session = await lucia.createSession(user.userId);
const sessionCookies = lucia.createSessionCookies(session);

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Comparison with Other Libraries:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🆚 &lt;strong&gt;Supabase auth, SuperTokens, NextAuth&lt;/strong&gt;: These libraries have too much abstraction for users to have control over their authentication flow. Lucia gives you the tools to craft authentication that fits your app perfectly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Demo Repo&lt;/strong&gt;: Check out my example repo using Lucia with Next.js and Prisma ORM: &lt;a href="https://lnkd.in/gHdq6CYB"&gt;Lucia Basic Starter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you're tired of authentication libraries that dictate how you should build your app, give Lucia a try. Explore more about Lucia in the &lt;a href="https://lnkd.in/ggkyNrJa"&gt;official documentation&lt;/a&gt;. Have questions? Feel free to reach out on GitHub or Discord. Let's empower our apps with flexible and secure authentication together! 🌟&lt;/p&gt;

&lt;h1&gt;
  
  
  LuciaAuth #Security #WebDevelopment #OpenSource
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>opensource</category>
      <category>luciaauth</category>
      <category>security</category>
    </item>
    <item>
      <title>Top 10 Visual Studio Code Themes for a Stylish Coding Experience</title>
      <dc:creator>Asm Raihan</dc:creator>
      <pubDate>Sun, 21 May 2023 06:53:38 +0000</pubDate>
      <link>https://forem.com/asmraihan/top-10-visual-studio-code-themes-for-a-stylish-coding-experience-2h91</link>
      <guid>https://forem.com/asmraihan/top-10-visual-studio-code-themes-for-a-stylish-coding-experience-2h91</guid>
      <description>&lt;p&gt;Visual Studio Code (VS Code) has emerged as one of the most popular code editors among developers due to its flexibility, extensive features, and a vibrant community. One of the standout features of VS Code is the ability to customize its appearance with themes. Themes not only add a touch of personalization but also enhance productivity by providing a visually pleasing and distraction-free environment. In this blog post, we will explore the top 10 VS Code themes that can transform your coding experience into a stylish and immersive journey.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. Gruvbox:&lt;/strong&gt;&lt;br&gt;
Gruvbox is a popular retro-inspired theme that brings a nostalgic feel to VS Code. It features warm and earthy colors, reminiscent of old computer terminals and vintage design. Gruvbox offers both light and dark variants, allowing you to choose the one that suits your coding style.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;09. Ayu:&lt;/strong&gt;&lt;br&gt;
Ayu is a minimalistic theme that focuses on simplicity and clarity. It offers three variants: Light, Mirage, and Dark. The Light variant provides a clean and bright interface, while the Mirage and Dark variants feature muted colors that reduce visual distractions. Ayu is well-suited for those who prefer a minimal and distraction-free coding environment.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;08. Monokai Pro:&lt;/strong&gt;&lt;br&gt;
Monokai Pro is a modern take on the classic Monokai theme. It offers a wide range of customizable options, allowing you to fine-tune the colors and visual elements to your liking. With its vibrant and saturated colors, Monokai Pro provides an energetic and immersive coding environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Uebzu-4w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2jkdqk7h0ql0twyw0kj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Uebzu-4w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w2jkdqk7h0ql0twyw0kj.png" alt="Image description" width="665" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;07. Shades of Purple:&lt;/strong&gt;&lt;br&gt;
As the name suggests, Shades of Purple is a theme that revolves around various shades of purple. This vibrant and stylish theme offers a mix of dark and light purples, creating an eye-catching coding experience. It provides an excellent balance between aesthetics and readability.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;06. Nord:&lt;/strong&gt;&lt;br&gt;
Nord is a popular theme known for its cool and calm color scheme. It features a blend of frosty blues, soothing purples, and soft grays. The overall effect is a visually pleasing and consistent environment that reduces eye strain during long coding sessions. Nord also offers variants optimized for different types of color blindness.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;05. Night Owl:&lt;/strong&gt;&lt;br&gt;
If you prefer a theme that adapts to different lighting conditions, Night Owl is an excellent choice. With its deep blue background and contrasting bright colors, it provides an immersive experience for both dark and well-lit environments. Night Owl also offers semantic highlighting, which differentiates code elements based on their functionality.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;04. One Dark Pro:&lt;/strong&gt;&lt;br&gt;
Inspired by Atom's One Dark theme, One Dark Pro brings a beautiful and consistent experience to VS Code. It offers a balanced combination of dark shades with vivid colors for syntax highlighting, making code elements stand out. One Dark Pro has a clean and uncluttered design, promoting focus and productivity.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;03. LWS Theme:&lt;/strong&gt;&lt;br&gt;
Learn with Sumit Theme is a visually appealing theme that emphasizes readability. It features a combination of dark blue and bright yellow, which creates a high contrast environment that is easy on the eyes. LWS also offers customizations for specific languages, improving the syntax highlighting for various programming languages.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;02. Material Theme:&lt;/strong&gt;&lt;br&gt;
The Material Theme brings the popular Material Design aesthetic to VS Code. It offers a clean and modern interface with vibrant colors, subtle animations, and well-designed icons. The theme provides both light and dark variants, allowing you to switch between them based on your preference.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;01. Dracula:&lt;/strong&gt;&lt;br&gt;
Dracula is a beloved theme among developers for its dark and vibrant color palette. The combination of dark purple, black, and neon green accents creates a visually striking and highly readable coding environment. Dracula is easy on the eyes, making it suitable for long coding sessions.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Bonus:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Vivid Black&lt;/strong&gt;&lt;br&gt;
My custom made vs codetheme Vivid Black is now on marketplace. Vivid Black Theme offers bright color code with dark background tailored for personal preference.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The choice of a VS Code theme is a personal one, as it affects your coding experience and productivity. The top 10 themes mentioned in this blog post offer a wide range of options, from vibrant and bold designs to minimalistic and calming interfaces. Experiment with different themes to find the one that resonates with your style and preferences, and enjoy a visually appealing and immersive coding journey with Visual Studio Code.&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>theme</category>
      <category>programming</category>
      <category>coding</category>
    </item>
    <item>
      <title>Guide to React leaflet</title>
      <dc:creator>Asm Raihan</dc:creator>
      <pubDate>Thu, 04 May 2023 19:51:19 +0000</pubDate>
      <link>https://forem.com/asmraihan/guide-to-react-leaflet-1246</link>
      <guid>https://forem.com/asmraihan/guide-to-react-leaflet-1246</guid>
      <description>&lt;p&gt;React Leaflet provides bindings between React and Leaflet. It uses Leaflet to abstract Leaflet layers and turn them into React components, not replacing Leaflet.&lt;/p&gt;

&lt;p&gt;React-leaflet is very easy to implement. But the official documentation is a little vague to me. So here are we,&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STEP - 1 // Installing React-Leaflet as dependency&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install react-leaflet&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add react-leaflet&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;STEP - 2 // Importing components&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;All the components and hooks can be imported from the module entry-point:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MapContainer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Marker&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Popup&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;TileLayer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useMap&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-leaflet&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For TypeScript only&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add -D @types/leaflet
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;STEP - 3 // Creating map component&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MapContainer&lt;/span&gt; &lt;span class="na"&gt;center&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;38.706928957217166&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;35.51448175987359&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;zoom&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;scrollWheelZoom&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;TileLayer&lt;/span&gt;

                    &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"&lt;/span&gt;
                &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Marker&lt;/span&gt; &lt;span class="na"&gt;position&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mf"&gt;38.706928957217166&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;35.51448175987359&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Popup&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                        popup &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;br&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt; message.
                    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Popup&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Marker&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;MapContainer&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;STEP - 4 // Adding CSS style to show map properly&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.leaflet-container&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vw&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are all set. This is the basic usage of leaflet. See the official documentation for more customization. Have fun!&lt;br&gt;
&lt;a href="https://www.npmjs.com/package/react-leaflet"&gt;https://www.npmjs.com/package/react-leaflet&lt;/a&gt;&lt;br&gt;
&lt;a href="https://react-leaflet.js.org/docs/start-installation/"&gt;https://react-leaflet.js.org/docs/start-installation/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://leafletjs.com/"&gt;https://leafletjs.com/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/PaulLeCam/react-leaflet"&gt;https://github.com/PaulLeCam/react-leaflet&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>leaflet</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>React useState and useEffect hooks explained in simple term with example</title>
      <dc:creator>Asm Raihan</dc:creator>
      <pubDate>Tue, 18 Apr 2023 11:02:25 +0000</pubDate>
      <link>https://forem.com/asmraihan/react-usestate-and-useeffect-hooks-explained-in-simple-term-with-example-ofj</link>
      <guid>https://forem.com/asmraihan/react-usestate-and-useeffect-hooks-explained-in-simple-term-with-example-ofj</guid>
      <description>&lt;p&gt;React hooks were introduced in React version 16.8. The main purpose was to make functional components more useful .&lt;br&gt;
Hooks allows us to change the state of react components (useState) or performing an after effect when changes occur in component state without the need of class component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RULES of react hooks,&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1.React hooks can only be used in react functions.&lt;br&gt;
2.React hooks must be called at the top level.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;useState in hook in react :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;First what is state in react?&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A built in react object&lt;/li&gt;
&lt;li&gt;Can be used to store data about components.&lt;/li&gt;
&lt;li&gt;States are mutable, meaning their value can change&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The useState() hook allows us to have state variables in the React functional component. It takes one argument which is the initial state and returns a state value and a function to update it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;increaseCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5 common usage of useState() ,&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Counter&lt;/li&gt;
&lt;li&gt;State management.&lt;/li&gt;
&lt;li&gt;Conditional rendering.&lt;/li&gt;
&lt;li&gt;Toggler (ON/OFF,True/False)&lt;/li&gt;
&lt;li&gt;Store api.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;useEffect in hook in react :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What are side effects in react?&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Actions which are performed with the outside world&lt;/li&gt;
&lt;li&gt;Unpredictable because it can depend upon various things outside of react scope.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;useEffect() hook accepts 2 arguments:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;    &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;[,&lt;/span&gt; &lt;span class="nx"&gt;dependencies&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Callback is a function that contains the side-effect logic. callback is executed right after the DOM update.&lt;br&gt;
dependencies is an optional array of dependencies. useEffect() executes callback only if the dependencies have changed between renderings.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;  &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
   &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;cleanup&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Side-effect cleanup...&lt;/span&gt;
   &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;},[&lt;/span&gt;&lt;span class="nx"&gt;dependencies&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Common usage of useEffect() ,&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Making request to an api for data&lt;/li&gt;
&lt;li&gt;Performs asynchronous tasks
&lt;/li&gt;
&lt;li&gt;To interact with browser api to manipulate DOM directly.&lt;/li&gt;
&lt;li&gt;Reading data from local storage&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What is the use Effect cleanup function?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The useEffect cleanup allows us to tidy up our code before our component unmounts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When our code runs and reruns for every render, useEffect also cleans up after itself using the cleanup function.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The cleanup function prevents memory leaks and removes some unnecessary and unwanted behaviors. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>hooks</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
